I was perusing the kynetx docs, when I came across this operator in regards to twitter API
=>
What does it mean? It looks like the terenary operator in C++/C#/C etc.
Is it?
|
2
|
I was perusing the kynetx docs, when I came across this operator in regards to twitter API
What does it mean? It looks like the terenary operator in C++/C#/C etc. Is it? |
||
|
|
|
2
|
The => symbol is used in KRL as the condition separator in conditional expressions and as the separator for names in actions. Conditional expressions are denoted by the following syntax:
where the meaning is that is executed and returned if is true and is executed and returns otherwise. These can be nested to create complex conditional expressions like so:
Note that this is an expression and returns a result. It can only be used where expressions are valid. Actions in KRL can have names. The purpose is to allow multiple actions in a single rule to be identified in the analytics. The name is separated from the action uing the => symbol.
|
|||
|
|
0
|
Why yes! It is exactly like the ternary operator! If you don't know what that is, don't worry, the => operator (? operator in other languages) is used like this:
this is equivalent to (in KRL):
This operator is especially useful in variable assignments, as you can assign different values based on how it evaluates. For example:
This statement says someBoolVar is true of someOtherBool is true, else assign someBoolVar to false. |
|||
|