Conditional structures: Difference between revisions

No edit summary
Line 7,381:
 
<syntaxhighlight lang="tqs">%formatted = %str @ ((getSubStr(%str,strLen(%str) - 1,1) $= "s") ? "'" : "'s");</syntaxhighlight>
 
 
=={{header|Transd}}==
 
Transd has as an universal conditional expression - the '''if-elsif-else''' operator. Also, the conditional evaluation
is achieved through logical functions.
 
<syntaxhighlight lang="Scheme">#lang transd
 
MainModule: {
_start: (λ locals: b 1 c 0
(textout (if b "OK" else "NO") "\n")
 
// switch/case emulation
 
(textout (* 5
(if (== b 0) 2
elsif (== b 1) 5
else 6)) "\n")
 
// example of using 'or' as a conditional construct
 
(or (!= c 0) (textout "c is 0"))
)
}</syntaxhighlight>
{{out}}
<pre>
OK
25
c is 0
</pre>
 
=={{header|Trith}}==
111

edits