aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/switch.moon
blob: 3bc179b3729f13db79263766f02e96f2635e2375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

switch value
  when "cool"
    print "hello world"


switch value
  when "cool"
    print "hello world"
  else
    print "okay rad"


switch value
  when "cool"
    print "hello world"
  when "yeah"
    [[FFFF]] + [[MMMM]]
  when 2323 + 32434
    print "okay"
  else
    print "okay rad"

out = switch value
  when "cool" then print "hello world"
  else print "okay rad"

out = switch value
  when "cool" then xxxx
  when "umm" then 34340
  else error "this failed big time"

with something
  switch \value!
    when .okay
      "world"
    else
      "yesh"

fix this
call_func switch something
  when 1 then "yes"
  else "no"

--

switch hi
  when hello or world
    greene

--

switch hi
  when "one", "two"
    print "cool"
  when "dad"
    no

switch hi
  when 3+1, hello!, (-> 4)!
    yello
  else
    print "cool"