FANDOM


The When side of a line makes the most sense when it is asking a yes or no question.

Template:KodeShare

The when side of the above asks a yes or no question because it evaluates to a boolean: is speed greater than 5? if yes, then jump. However, you can have just about any value type on the When side and it will still be valid.

This probably makes the most sense for the Boolean type. Let's look at the [on ground] tile as an example of a Boolean.

Template:KodeShare

The [on ground] tile acts as any Boolean variable and will only jump when [on ground] is true.

Some of the types make a bit less sense, but usually the idea is that if a value is false, zero or nothing then don't execute your rule, otherwise do. To illustrate this, let's look at a number variable. Template:KodeShare

So, for a number like above, if the value of the number is anything other than 0, then the do side will be executed.

One variable type that does not support this is the Color variable. Color variables don't appear to have any value that will cause them to NOT execute their rules (that I know of) when evaluated. This kind of makes sense, because there isn't really any such thing as no color, but there is a [no color] tile, so I'm not too sure...

When evaluating an object set, if the set contains any object(s) then the Do side will be executed. This also sets the [them] and [it] tiles, as explained in The Magical It and Them Tiles section.

When evaluating a vector, if the vector is any value except for the zero vector then the Do side will be executed.

When evaluating a brain, if the brain variable is tracking any brain then the Do side will be executed.

etc...


Read NextEdit

Expressions


Further ReadingEdit

Timing and Logic

Brain Tiles


< Back to Koding Curriculum