Conditions
Standard uses boolean logic to evaluate conditions. This means triggering of logic is predicated on a true or false return.
price 5
print (price == 5) #Prints true
print (price = 5) #Prints true
print (price < 5) #Prints false
print (price > 5) #Prints false
print (price >= 5) #Prints true
If-equals short-hand
Since Standard does not use = to set variables to value, you can also exclude it when checking value equality.
Note: This is for checking equality of values. When comparing two variables using ==, the memory addresses are compared.
print (p 5) #Prints true
print (p 7) #Prints false
f1 7
f2 7
print (f1 f2) #Prints true, uses euqlas-short-hand
print (f1 == f2) #Prints false, values at different addresses
If Conditions
If, if-else, and else-if conditions will be the core of the logic your programs will perform.
If
A simple if condition follows if: ARGS {...} where ... is the suceeding arguments to be processed if the condition is met.
if: 7 > 5 {
print "Duh!"
}
If-else
If the first condition is not met and another condition should be checked, then use if-else to start a condition tree. If-else will follow the if struture but will be suceeded by ...else: ARGS {...}.
in number
if: number > 5 {
print "Nice, more than 5 is great!"
} else: number < 0 {
print "Number should be more than 0!"
}
Short Hand
When using if-else conditions and the else will have no arguments, simply exclude else.
if: 5 < 7 {
print "5 is less than 7! YAY!"
}:{
print "Your computer can't do math!"
}
Boolean Operators
To build more complex conditions, you can use and, or, &, &&, |, ||.
in username "Username: "
in psswd "Password: "
if: username "" and psswd "" {
print "Welcome in!"
}:{
print "Denied"
}
Negation
If you have a boolean value, prepend the value or variable with ! to negate.
bool true
print !bool #Prints false