Quote:
Originally Posted by Tolnaftate2004
? separates the condition from two statements that could be made:
condition?statements;
: separates the two statements apart from one another:
statement1:statement2
All they do is tell the computer where one piece ends and another starts. Both the ? and the : need to be present for the operator to function correctly.
They can also be nested:
a?b?c:d:e is "translated" into a?(b?c:d):e
You will always have # statements = # conditions + 1.
|
That explains how to use them, thanks
Quote:
Originally Posted by Googi
Before the ? you put a condition. If that condition is true, the code between the ? and the : is executed*. If it's not true, then the code after the : is executed.
*It would be more accurate to say that the code/content either before or after the : replaces the entire statement, but the way it's phrased above makes it easier to understand.
|
That explains what they do, thanks
But sometimes I see someone's script and it doesnt have a ? in it, so clearly you don't ALWAYS have to use a ?. What are examples like that and what happens in them?