-
-
Notifications
You must be signed in to change notification settings - Fork 4
switch
Pannous edited this page Dec 28, 2022
·
3 revisions
color=red
switch color {
green: print "woods!"
red: say "fire!"
}
the switch operator in wasp is similar to map indexing:
action_map={
green: print "woods!"
red: say "fire!"
}
switch color action_map == action_map[color] or action_map[default] !
get color within action_map
the difference between the switch operator and map indexing is that it is always an execution context and if no key matches it tries the ' default' key.