Conditional structures: Difference between revisions

m
Added SNOBOL4
m (I made a minor change to the SIMPOL section of the content.)
m (Added SNOBOL4)
Line 2,002:
<lang smalltalk>abs := x > 0 ifTrue: [ x ] ifFalse: [ x negated ]</lang>
 
=={{header|SNOBOL4}}==
SNOBOL4 has no structured programming features, but the two constructs in question could be easily emulated with FAILURE/SUCCESS and indirect jumps
 
<lang snobol> A = "true"
* "if-then-else"
if A "true" :s(goTrue)f(goFalse)
goTrue output = "A is TRUE" :(fi)
goFalse output = "A is not TRUE" :(fi)
fi
 
* "switch"
switch A ("true" | "false") . switch :s($("case" switch))f(default)
casetrue output = "A is TRUE" :(esac)
default
casefalse output = "A is not TRUE" :(esac)
esac
end</lang>
 
=={{header|SNUSP}}==
Anonymous user