Short-circuit evaluation: Difference between revisions
Content added Content deleted
Line 896: | Line 896: | ||
The choice we make is that <code>funky</code> is ordinary if the right-side expression was evaluated, and otherwise is <em>ruined</em>; attempts to access the variable give an error. |
The choice we make is that <code>funky</code> is ordinary if the right-side expression was evaluated, and otherwise is <em>ruined</em>; attempts to access the variable give an error. |
||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA |
ELENA 4.x : |
||
<lang elena>import system'routines |
<lang elena>import system'routines; |
||
import extensions |
import extensions; |
||
a(x) |
Func<bool, bool> a = (bool x){ console.writeLine:"a"; ^ x }; |
||
b(x) |
Func<bool, bool> b = (bool x){ console.writeLine:"b"; ^ x }; |
||
const bool[] boolValues = new bool[] { false, true }; |
|||
⚫ | |||
⚫ | |||
{ |
|||
boolValues.forEach:(bool i) |
|||
⚫ | |||
boolValues.forEach:(bool j) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
[ |
|||
⚫ | |||
(false, true) forEach(:i) |
|||
} |
|||
} |
|||
(false, true) forEach(:j) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
{{out}} |
{{out}} |
||
<pre> |
<pre> |