Files
sybil/examples/branch.sy
Alek Ratzloff cb9e09064a Implement __bool__, add if builtin, vtable imporvements
* `if` builtin is the big one here - branching! Yay!
* The `if` builtin requires __bool__ to be implemented for things. This
  is added for all builtin objects.
* Vtables have slightly better ergonomics.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-02-04 17:29:41 -08:00

7 lines
441 B
Plaintext

[ "fail - 0 is not truthy" println! ] [ "OK" println! ] 0 if!
[ "OK" println! ] [ "fail - 1 is truthy" println! ] 1 if!
[ "OK" println! ] [ "fail - 1.1 is truthy" println! ] 1.1 if!
[ "OK" println! ] [ "fail - 0.1 is truthy" println! ] 0.1 if!
[ "OK" println! ] [ "fail - -0.1 is truthy" println! ] -0.1 if!
[ "fail - -0.0 is not truthy" println! ] [ "OK" println! ] -0.0 if!
[ "fail - 0.0 is not truthy" println! ] [ "OK" println! ] 0.0 if!