Operations

Logical Operations

  • Negation:

    • if my_node is not Node3D:

    • or

    • if not my_node is Node3D:

Ternary Operations

  • Documentation .

  • var slowness = 0 if current_effects["Slowness"] == null else current_effects["Slowness"].value

  • variable = (1 - (0 if (current_effects["Slowness"] == null) else (current_effects["Slowness"].value) / 100.0))

    • Be careful in this part: '(1 - (0'! Important to separate what belongs to IF and what does not!

  • print("greater than zero" if (counter > 0) else "less than or equal to zero")

Bitwise Operations

  • OR | : "the result is an append".

  • XOR ^ : "the result is a de-append"

  • AND & : "the result is the intersection"

  • Define an Enum:

enum effect {
    SLOWNESS = 1
    STUN = 2
    SILENCE = 4
    PUSH = 8
    POISON = 16
    #...    
}
  • Boolean evaluations:

(a & b): ## True if there is an intersection between a and b.
()
  • Operations:

a |= b   # append
a ^= b   # (?) de-append
a &= ~b  # remove 'b' from 'a'