Short-circuit evaluation: Difference between revisions

Content added Content deleted
m (→‎{{header|Ring}}: Remove vanity tags)
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 3.3 :
ELENA 3.4 :
<lang elena>import system'routines.
<lang elena>import system'routines.
import extensions.
import extensions.
symbol a = (:x)[ console writeLine:"a". ^ x. ].
a(x)[ console writeLine:"a". ^ x. ]
symbol b = (:x)[ console writeLine:"b". ^ x. ].
b(x)[ console writeLine:"b". ^ x. ]
program =
public program
[
[
(false, true) forEach(:i)
(false, true) forEach(:i)
Line 914: Line 914:
console writeLine.
console writeLine.
console printLine(i," or ",j," = ",a(i) || $(b(j))).
console printLine(i," or ",j," = ",a(i) || $(b(j))).
console writeLine.
console writeLine
].
]
].
]
].</lang>
]</lang>
{{out}}
{{out}}
<pre>
<pre>