@@ -14,20 +14,30 @@ The package supports:
1414* ** booleans** - ` true ` and ` false `
1515* ** nil** - ` nil `
1616
17+ ## Digit separators
18+
19+ Integer literals may contain digit separators to allow digit grouping into more legible forms.
20+
21+ Example:
22+
23+ ```
24+ 10_000_000_000
25+ ```
26+
1727## Accessing Public Properties
1828
1929Public properties on structs can be accessed by using the ` . ` syntax.
2030If you pass an array into an expression, use the ` [] ` syntax to access array keys.
2131
22- ``` coffeescript
32+ ``` js
2333foo .Array [0 ].Value
2434```
2535
26- ## Calling Methods
36+ ## Functions and Methods
2737
28- The ` . ` syntax can also be used to call methods on an struct.
38+ Functions may be called using ` () ` syntax. The ` . ` syntax can also be used to call methods on an struct.
2939
30- ``` coffeescript
40+ ``` js
3141price .String ()
3242```
3343
@@ -46,20 +56,10 @@ The package comes with a lot of operators:
4656
4757Example:
4858
49- ``` coffeescript
59+ ``` js
5060life + universe + everything
5161```
5262
53- ### Digit separators
54-
55- Integer literals may contain digit separators to allow digit grouping into more legible forms.
56-
57- Example:
58-
59- ```
60- 10_000_000_000
61- ```
62-
6363### Comparison Operators
6464
6565* ` == ` (equal)
@@ -91,15 +91,15 @@ life < universe || life < everything
9191
9292To test if a string does * not* match a regex, use the logical ` not ` operator in combination with the ` matches ` operator:
9393
94- ``` coffeescript
94+ ``` js
9595not (" foo" matches " ^b.+" )
9696```
9797
9898You must use parenthesis because the unary operator ` not ` has precedence over the binary operator ` matches ` .
9999
100100Example:
101101
102- ``` coffeescript
102+ ``` js
103103' Arthur' + ' ' + ' Dent'
104104```
105105
@@ -112,11 +112,11 @@ Result will be set to `Arthur Dent`.
112112
113113Example:
114114
115- ``` coffeescript
115+ ``` js
116116user .Group in [" human_resources" , " marketing" ]
117117```
118118
119- ``` coffeescript
119+ ``` js
120120" foo" in {foo: 1 , bar: 2 }
121121```
122122
@@ -126,13 +126,13 @@ user.Group in ["human_resources", "marketing"]
126126
127127Example:
128128
129- ``` coffeescript
129+ ``` js
130130user .Age in 18..45
131131```
132132
133133The range is inclusive:
134134
135- ``` coffeescript
135+ ``` js
1361361..3 == [1 , 2 , 3 ]
137137```
138138
@@ -142,7 +142,7 @@ The range is inclusive:
142142
143143Example:
144144
145- ``` coffeescript
145+ ``` js
146146user .Age > 30 ? " mature" : " immature"
147147```
148148
@@ -159,9 +159,10 @@ user.Age > 30 ? "mature" : "immature"
159159
160160Example:
161161
162- ``` go
163- // Ensure all tweets are less than 140 chars.
164- all (Tweets, {.Size < 140 })
162+ Ensure all tweets are less than 280 chars.
163+
164+ ``` js
165+ all (Tweets, {.Size < 280 })
165166```
166167
167168## Closures
@@ -170,14 +171,14 @@ all(Tweets, {.Size < 140})
170171
171172Closures allowed only with builtin functions. To access current item use ` # ` symbol.
172173
173- ``` go
174- map (0 ..9 , {# + 1 })
174+ ``` js
175+ map (0..9 , {# / 2 })
175176```
176177
177178If the item of array is struct, it's possible to access fields of struct with omitted ` # ` symbol (` #.Value ` becomes ` .Value ` ).
178179
179- ``` go
180- filter (Tweets, {. Size > 140 })
180+ ``` js
181+ filter (Tweets, {len (. Value ) > 280 })
181182```
182183
183184## Slices
@@ -188,8 +189,9 @@ Slices can work with arrays or strings.
188189
189190Example:
190191
191- ``` go
192- // array is [1,2,3,4,5]
192+ Variable ` array ` is ` [1,2,3,4,5] ` .
193+
194+ ``` js
193195array[1 : 5 ] == [2 ,3 ,4 ]
194196array[3 : ] == [4 ,5 ]
195197array[: 4 ] == [1 ,2 ,3 ]
0 commit comments