aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/funcs.yue
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-02-17 11:22:07 +0800
committerLi Jin <dragon-fly@qq.com>2021-02-17 11:22:07 +0800
commit7066392d1c974065181d95d93274136dcd625d43 (patch)
treecf51eafc2c52cbc12246a306bca172d799193d30 /spec/inputs/funcs.yue
parent90cd12ad9ef465f3e435e1bd034dcfbe4e19d016 (diff)
downloadyuescript-7066392d1c974065181d95d93274136dcd625d43.tar.gz
yuescript-7066392d1c974065181d95d93274136dcd625d43.tar.bz2
yuescript-7066392d1c974065181d95d93274136dcd625d43.zip
stop reusing variables, rename project.
Diffstat (limited to 'spec/inputs/funcs.yue')
-rw-r--r--spec/inputs/funcs.yue161
1 files changed, 161 insertions, 0 deletions
diff --git a/spec/inputs/funcs.yue b/spec/inputs/funcs.yue
new file mode 100644
index 0000000..0e45ff1
--- /dev/null
+++ b/spec/inputs/funcs.yue
@@ -0,0 +1,161 @@
1
2
3x = -> print what
4
5_ = ->
6
7_ = -> -> ->
8
9go to the barn
10
11open -> the -> door
12
13open ->
14 the door
15 hello = ->
16 my func
17
18h = -> hi
19
20eat ->, world
21
22
23(->)()
24
25x = (...) ->
26
27hello!
28hello.world!
29
30_ = hello!.something
31_ = what!["ofefe"]
32
33what! the! heck!
34
35_ = (a,b,c,d,e) ->
36
37_ = (a,a,a,a,a) ->
38 print a
39
40_ = (x=23023) ->
41
42_ = (x=(y=()->) ->) ->
43
44_ = (x = if something then yeah else no) ->
45
46something = (hello=100, world=(x=[[yeah cool]])-> print "eat rice") ->
47 print hello
48
49_ = () =>
50_ = (x, y) =>
51_ = (@x, @y) =>
52_ = (x=1) =>
53_ = (@x=1,y,@z="hello world") =>
54
55
56x -> return
57y -> return 1
58z -> return 1, "hello", "world"
59k -> if yes then return else return
60
61_ = -> real_name if something
62
63--
64
65d(
66 ->
67 print "hello world"
68 10
69)
70
71
72
73d(
74 1,2,3
75 4
76 5
77 6
78
79 if something
80 print "okay"
81 10
82
83 10,20
84)
85
86
87f(
88
89 )(
90
91 )(
92 what
93 )(->
94 print "srue"
95 123)
96
97--
98
99x = (a,
100 b) ->
101 print "what"
102
103
104y = (a="hi",
105 b=23) ->
106 print "what"
107
108z = (
109 a="hi",
110 b=23) ->
111 print "what"
112
113
114j = (f,g,m,
115 a="hi",
116 b=23
117) ->
118 print "what"
119
120
121y = (a="hi",
122 b=23,
123 ...) ->
124 print "what"
125
126
127y = (a="hi",
128 b=23,
129 ...
130) ->
131 print "what"
132
133--
134
135args = (a
136 b) ->
137 print "what"
138
139
140args = (a="hi"
141 b=23) ->
142 print "what"
143
144args = (
145 a="hi"
146 b=23) ->
147 print "what"
148
149
150args = (f,g,m
151 a="hi"
152 b=23
153) ->
154 print "what"
155
156
157@ = (n)->
158 return 1 if n == 0
159 n * @(n-1)
160
161nil