got case statements wokring

This commit is contained in:
Jeremy Ashkenas
2009-12-15 22:30:27 -05:00
parent c840696f73
commit e48d49df3b
5 changed files with 853 additions and 760 deletions

View File

@@ -1,5 +1,4 @@
# TODO: switch/case statements
# Think of a name for this crazy thing.
# TODO: Think of a name for this crazy thing.
# Functions:
square: x => x * x.
@@ -100,3 +99,14 @@ b: 20
supper: food.capitalize() for food in ['toast', 'cheese', 'wine'].
drink(bottle) for bottle, i in ['soda', 'wine', 'lemonade'] if even(i).
# Switch statements.
switch day
case "Tuesday" then eat_breakfast()
case "Sunday" then go_to_church()
case "Saturday" then go_to_the_park().
case "Wednesday"
eat_breakfast()
go_to_work()
eat_dinner()
default go_to_work().