Short-circuit evaluation: Difference between revisions

Content deleted Content added
Alextretyak (talk | contribs)
Added 11l
Updates to work with Nim 1.4: added missing parameter types. Did also some formatting and added a general comment.
Line 2,511: Line 2,511:


=={{header|Nim}}==
=={{header|Nim}}==
Nim produces code which uses short-circuit evaluation.
<lang nim>proc a(x): bool =
<lang nim>proc a(x): bool =
echo "a called"
echo "a called"
result = x
result = x

proc b(x): bool =
proc b(x): bool =
echo "b called"
echo "b called"
Line 2,519: Line 2,521:


let x = a(false) and b(true) # echoes "a called"
let x = a(false) and b(true) # echoes "a called"
let y = a(true) or b(true) # echoes "a called"</lang>

let y = a(true) or b(true) # echoes "a called"</lang>


=={{header|Objeck}}==
=={{header|Objeck}}==