If statements let you compare values.
You can make a script have an if statement by doing:
"if (value) (operator) (value2)
[action you want the script to do, for example: print if statements are cool]
end"
Here is an example of a script with an if statement:
var score 5
if score == 5
print if statements are cool
end
if statements are cool
If statements let you compare a value, but what if you want something to happen if the if statement is not true? That's where else comes in handy.
You can add an else statement if you have an if statement, like this:
"if (value) (operator) (value2)
[action you want the script to do, for example: print its true]
else
[action you want the script to do, for example: print its not true!]
end"
Here is an example of a script with an else
var score 4
if score == 5
print its true
else
print its not true!
end
its not true!