Skip to content

Commit c51dcab

Browse files
committed
Update docs
1 parent 383b95c commit c51dcab

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,20 @@ let coercion: Double = "1.234e2"; // coercion of string to double
293293

294294
##### Strings
295295

296-
A fundamental part of creating programs is working with textual data. As in other languages, we use the type string to refer to these textual types. Strings are represented by characters between either a single quote or a double quote. When characters are between double quotes they are interpolated, meaning they have expressions evaluated within them. These expressions start with the dollar character. All strings can span multiple lines.
296+
A fundamental part of creating programs is working with textual data. As in other languages,
297+
we use the type string to refer to these textual types. Strings are represented by characters
298+
between either a single quote or a double quote. When characters are between double quotes they
299+
are interpolated, meaning they have expressions evaluated within them. These expressions start
300+
with the dollar character. All strings can span multiple lines.
297301

298302
```js
299303
let string = 'Hello World!'; // literal string
300304
let template = "The sum of 1 and 2 is ${1 + 2}"; // interpolated string
301305
let concat = "The sum of 1 and 2 is " + (1 + 2); // concatenation
306+
let multiline = "Details
307+
a) This is a new line
308+
b) This is another new line";
309+
302310
```
303311

304312
##### Arrays
@@ -323,6 +331,13 @@ let list = [1, 2, 3]; // creates an ArrayList
323331
let map = {"a": 1, "b": 2}; // creates a LinkedHashSet
324332
let empty = {:}; // creates an empty map
325333
let mix = [1, 2, {"a": {"a", "b", [55, 66]}}]; // mix collection types
334+
let multiline = {
335+
name: "John Doe",
336+
address: "Unknown",
337+
age: 33
338+
};
339+
let ascending = [0 to 9]; // range of increasing numbers
340+
let descending = [0 from 9]; // range of decreasing numbers
326341
```
327342

328343
### Operators
@@ -504,7 +519,8 @@ while(n < 10) { // conditional loop
504519
505520
#### For Statement
506521
507-
The for statement is typically used to count over a range of numeric values. It contains three parts, a declaration, a condition, and an optional statement which is evaluated at the end of the loop.
522+
The for statement is typically used to count over a range of numeric values. It contains three parts, a
523+
declaration, a condition, and an optional statement which is evaluated at the end of the loop.
508524
509525
```js
510526
for(let i = 0; i < 10; i++){ // loops from 1 to 10
@@ -532,6 +548,14 @@ for(e in 0..9) { // iterates from 0 to 9
532548
}
533549
println(e); // prints from 0 to 6
534550
}
551+
552+
for(i in 0 to 9) { // iterates from 0 to 9
553+
println(i);
554+
}
555+
556+
for(i in 0 from 9) { // iterates from 9 to 0
557+
println(i)
558+
}
535559
```
536560
#### Loop Statement
537561

0 commit comments

Comments
 (0)