READ THIS POST WITH THIS SONG PLAYING.
(if you are a true memer you should recognize the first note immediately)]
I really don't see the difference here.
Most people have the argument of "Don't use while wait() do, becuase it doesn't properly emphasize what you're trying to get across."
But how so? The first time I came across the use of while wait() do, I immediately read it as "While you're waiting for blank, do this," but at first, that was a wrong notion.
Later in my scripting days, I ended up reading it as "After you wait for blank, do this."
I feel like it serves the same purpose as "while true do," because when I also came across the use of "while * do", I read it as "When this condition is true, do this." But, aren't you also waiting for the condition to be true?
But, one could also say:
Wait() is a function, and is not nil. If you were to plug the wait() function into a condition, it will run through it, because again, it is not nil. But, for some reason, it will also execute it's assigned function.
I'd love your input on this. Reading people's opinions is a fun pastime.
But, here comes the second question.
If you were to define a function, then put it into a conditional statement, it will return as "not nil", but also "nil?"
Alongside that, if the function were to return "true", then the "not" usage of the function will be falsey. You could probably guess for the contrary.
Let's put it into code terms.
Lets say I had my completely stupid function that I came up with in less than 5 minutes with a pad and pencil.
Cool. Now, let's go and make some tests. I made six conditional statements that has to do with the same function.
For the first two statements, I made the function return false.
Let's see what it returns.
This should make sense. The first one returns false, and that means the condition is falsey. Therefore, the code block did not run. The second one checks if it is returning false or nil, and as it did, the code block will run.
Now, let us run our true statements, shown below.
Again, let us see what it returns.
Again, some normal stuff. At this point, I might just be trying to extend the length of the forum post without knowing. Anyways, as expected, the first code block is true, because true == true, and second is falsey because false!==true.
Now, here comes the weird part to me, at least. For this test, we will be providing no variables for the function to use, again, shown below.
Now, lets see what kind of behemoth this thing pulled out from the deep, dark depths of kingdom come.
Uh, excuse me, what? I'm a stupid person. It took me QUITE a while to figure out why this happens, and unsurprisingly, it is a simple answer.
Apparently, by default, a function returns nil. The function itself is not nil, so that's good to know. I found this out from the second conditional.
But, alas, you likely didn't notice this that the first statement did not show. Instead, it called the function!
It called it twice..?
Anyways. Why did it call twice? I have no idea. Oh wait, I do. Maybe because the function was called in the first statement, and was called again in the second statement, working with two code blocks? I wonder, if I were to put a wait() inside of that if statement, would it yield the if block? Let's test.
And, what do you know? The function is called, AND the if statement isn't false! But.. wait..
Isn't a function supposed to return nil by default?
So, does that mean that if I were to have a function that returned true after 5, and called it in an if statement, it would wait(5) and complete the if statement? Odd. Don't think it did that in the previous examples.
Kidding. I was just leading you on with the wait thing. If you were to call the wait function inside of a print, it returns two values. The time provided, and the.. total execution time?
I have no idea what the second number is. Anyways, it's just two numbers with abstract purpose, in my opinion.
Also, there was no second question. Got ya again!
I hope ya enjoyed reading this, and I hope you also enjoyed being led on. Go out there and make your lives extraordinary!
"Carpe diem. Seize the day boys. Make your lives extraordinary" ~Robin Williams