Comparative Operators
A comparative operator is an operator that takes in operands and returns a boolean.
Equal to (==) (===)
When you want to check if a value is equal to another value in osl, there's multiple levels of how to do it.
Case Insensitive
When you want to do an equals check for two values that is case and type insensitive, you can use ==
Case Sensitive
When you want to do an equals check for two values that is case and type sensitive, you can use ===
Type Sensitivity is also a benefit of using ===
Greater than
You can check if a value is greater than another using the >
operator. Greater than is always case insensitive when using strings
Less than
You can also do the inverse of greater than and check if a value is less than another using the <
operator
Checking Contains
You can check if a value contains another value using
Ternary Operator (?)
The ?
operator provides a shorthand way to write simple if-else statements. It takes three operands: a condition followed by two values, where the first value is returned if the condition is true, and the second value if it's false.
Inverting A Comparison
You can simply place a ! infront of any comparison below to make it do the opposite of the norm.
Last updated
Was this helpful?