##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: August 2016 # Modified: 2016-10-03/22:39-0400 ##+ # # case.icn, demonstrate case selection # procedure main() c := "initial value" t := "e" # no match, no default, case will fail, c not re-assigned c := case t of { "a": "b" "c": "d" } write(image(c)) # no match, with default, c will be assigned to "f" c := case t of { "a": "b" "c": "d" default: "f" } write(image(c)) # first match satisfies case, c is assigned to "b" c := case t of { map("E"): "b" "e" : "d" default : "f" } write(image(c)) end