Short-circuit evaluation: Difference between revisions
Content added Content deleted
(→Insitux: inclusion) |
|||
Line 1,960: | Line 1,960: | ||
Shortcircuit.icn: 16 | true returned &null |
Shortcircuit.icn: 16 | true returned &null |
||
i,j := procedure true, procedure true</pre> |
i,j := procedure true, procedure true</pre> |
||
=={{header|Insitux}}== |
|||
{{trans|Clojure}} |
|||
<syntaxhighlight lang="insitux"> |
|||
(let a (fn (print-str "a ") %) |
|||
b (fn (print-str "b ") %) |
|||
f (pad-right " " 6)) |
|||
(for i [true false] j [true false] |
|||
(print-str (f i) "OR " (f j) " = ") |
|||
(print (or (a i) (b j))) |
|||
(print-str (f i) "AND " (f j) " = ") |
|||
(print (and (a i) (b j)))) |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
true OR true = a true |
|||
true AND true = a b true |
|||
true OR false = a true |
|||
true AND false = a b false |
|||
false OR true = a b true |
|||
false AND true = a false |
|||
false OR false = a b false |
|||
false AND false = a false |
|||
</pre> |
|||
=={{header|Io}}== |
=={{header|Io}}== |