RosettaCodeData/Task/Extend-your-language/Icon/extend-your-language.icon

21 lines
683 B
Plaintext

procedure main(A)
if2 { (A[1] = A[2]), (A[3] = A[4]), # Use PDCO with all three else clauses
write("1: both true"),
write("1: only first true"),
write("1: only second true"),
write("1: neither true")
}
if2 { (A[1] = A[2]), (A[3] = A[4]), # Use same PDCO with only one else clause
write("2: both true"),
write("2: only first true"),
}
end
procedure if2(A) # The double-conditional PDCO
suspend if @A[1] then
if @A[2] then |@A[3] # Run-err if missing 'then' clause
else @\A[4] # (all else clauses are optional)
else if @A[2] then |@\A[5]
else |@\A[6]
end