Skip to content

Switch Statements

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

Switch statements in bow work the way you would expect. If a case matches the switch condition then it executes that branch, falling into the below branches until broken out of the switch.

Example:

plant <-con str-< input("Enter your favourite plant: ")

switch plant ==>
    "cactus" ?->
        output("Amazing choice!")
        break
    "tree" ?->
        output("Uh kinda boring")
        break
    "grass" ?->
        output("Seriously?")
        break
    other ?->
        output("sorry I don't know that one")
<==
Clone this wiki locally