Conditional structures: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: removed superflous blanks, changed some '''version''' names. -- ~~~~)
Line 2,737: Line 2,737:
=={{header|REXX}}==
=={{header|REXX}}==
===IF THEN --- IF THEN/ELSE===
===IF THEN --- IF THEN/ELSE===
<lang rexx>if y then x=6 /* Y must be either 0 or 1 */
<lang rexx>
if y then x=6 /* Y must be either 0 or 1 */




if t**2>u then x=y
if t**2>u then x= y
else x=-y
else x=-y





if t**2>u then do j=1 to 10; say prime(j); end
if t**2>u then do j=1 to 10; say prime(j); end
else x=-y
else x=-y





Line 2,756: Line 2,753:
end
end
else do; z=0; say 'failed.'; end
else do; z=0; say 'failed.'; end





Line 2,762: Line 2,758:
substr(abc,4,1)=='@' then if z=0 then call punt
substr(abc,4,1)=='@' then if z=0 then call punt
else nop
else nop
else if z<0 then z=-y
else if z<0 then z=-y</lang>
</lang>


===SELECT WHEN===
===SELECT--WHEN===
<lang rexx> /*the WHEN conditional operators are the same as */
<lang rexx>
/*the WHEN conditional operators are the same as */
/*the IF conditional operators. */
/*the IF conditional operators. */


Line 2,780: Line 2,774:
/*if control reaches this point and none of the WHENs */
/*if control reaches this point and none of the WHENs */
/*were satisfiied, a SYNTAX condition is raised (error).*/
/*were satisfiied, a SYNTAX condition is raised (error).*/
end
end</lang>
===SELECT--WHEN/OTHERWISE===
</lang>
<lang rexx> select
===SELECT WHEN/OTHERWISE===
<lang rexx>
select
when a=='angel' then many='host'
when a=='angel' then many='host'
when a=='ass' | a=='donkey' then many='pace'
when a=='ass' | a=='donkey' then many='pace'
Line 2,797: Line 2,789:
say
say
exit 13
exit 13
end
end</lang>
</lang>


=={{header|Rhope}}==
=={{header|Rhope}}==