diff options
| -rw-r--r-- | prolog.html.markdown | 2 | ||||
| -rw-r--r-- | rst.html.markdown | 16 | ||||
| -rw-r--r-- | typescript.html.markdown | 24 | 
3 files changed, 37 insertions, 5 deletions
| diff --git a/prolog.html.markdown b/prolog.html.markdown index f7b55ac6..d4c28cba 100644 --- a/prolog.html.markdown +++ b/prolog.html.markdown @@ -75,7 +75,7 @@ magicNumber(42).  ?- 2 = 3.                            % False - equality test  ?- X = 3.                            % X = 3 - assignment  ?- X = 2, X = Y.                     % X = Y = 2 - two assignments -                                     % Note Y is assigned to, even though it is +                                     % Note Y is assigned too, even though it is                                       % on the right hand side, because it is free  ?- X = 3, X = 2.                     % False                                       % First acts as assignment and binds X=3 diff --git a/rst.html.markdown b/rst.html.markdown index 01595fe4..2423622e 100644 --- a/rst.html.markdown +++ b/rst.html.markdown @@ -47,19 +47,27 @@ Title are underlined with equals signs too  Subtitles with dashes  --------------------- -You can  put text in *italic* or in **bold**, you can "mark" text as code with double backquote ``print()``. +You can put text in *italic* or in **bold**, you can "mark" text as code with double backquote ``print()``. -Lists are as simple as in Markdown: +Lists are similar to Markdown, but a little more involved. + +Remember to line up list symbols (like - or *) with the left edge of the previous text block, and remember to use blank lines to separate new lists from parent lists:      - First item  - Second item -    - Sub item + +  - Sub item +     +- Third item  or  * First item  * Second item -    * Sub item +     +  * Sub item + +* Third item  Tables are really easy to write: diff --git a/typescript.html.markdown b/typescript.html.markdown index ba4a9e71..55d8cefe 100644 --- a/typescript.html.markdown +++ b/typescript.html.markdown @@ -223,6 +223,30 @@ moreNumbers[5] = 5; // Error, elements are read-only  moreNumbers.push(5); // Error, no push method (because it mutates array)  moreNumbers.length = 3; // Error, length is read-only  numbers = moreNumbers; // Error, mutating methods are missing + +// Iterators and Generators + +// for..of statement +// iterate over the list of values on the object being iterated +let arrayOfAnyType = [1, "string", false]; +for (const val of arrayOfAnyType) { +    console.log(val); // 1, "string", false +} + +let list = [4, 5, 6]; +for (const i of list) { +   console.log(i); // "4", "5", "6" +} + +// for..in statement +// iterate over the list of keys on the object being iterated +for (const i in list) { +   console.log(i); // "0", "1", "2", +} + + + +  ```  ## Further Reading | 
