Skip to content

If Altif Alt Flow Control

Coding Cactus edited this page Aug 7, 2022 · 1 revision

if is the initial condition, and then altifs are run if the previous conditions were false, and then alt runs if none of the conditons were true.

Example:

colour <-con str-< input("Enter your favourite colour: ")
sure   <-con str-< input("Are you sure (y/n): ")

if colour = "green" && sure = "y" ==>
    output("Yay, great choice")
<== altif colour = "green" && sure = "n" ==>
    output("Well, you should be, green is amazing")
<== alt ==>
    output("I suggest re-evaluating your life decisions")
<==
Clone this wiki locally