incompatible_ternary.gd 384 B

123456789
  1. func test():
  2. # The ternary operator below returns values of different types and the
  3. # result is assigned to a typed variable. This will cause a run-time error
  4. # if the branch with the incompatible type is picked. Here, it won't happen
  5. # since the `false` condition never evaluates to `true`. Instead, a warning
  6. # will be emitted.
  7. var __: int = 25
  8. __ = "hello" if false else -2