ink
ink copied to clipboard
Short-circuit Logical AND expressions
I have an Ink function of the form:
=== function can_do_something()
~ return some_var == 0 && some_expensive_to_run_external_function() == true
some_expensive_to_run_external_function
gets called every time, even when some_var == 0
Ideally, for performance, Ink would follow other languages where typical behavior is:
&& guarantees left-to-right evaluation: the second operand is not evaluated if the first operand is false.