diff --git a/content/block.md b/content/block.md index 8833dfa..b014a4f 100644 --- a/content/block.md +++ b/content/block.md @@ -24,6 +24,7 @@ block: Parentheses can be used as an expression, but they do not provide end of statement inference, so it is necessary to place semicolons yourself. ``` nimrod +# This doesn't work and I don't know what it should do square(( var result = newSeq[float](); for i in 0..1000: @@ -41,4 +42,4 @@ proc square(inSeq: seq[float]): seq[float] = ( result[i] = v*v; ) ) -``` \ No newline at end of file +``` diff --git a/content/case.md b/content/case.md index d0239f8..e582bde 100644 --- a/content/case.md +++ b/content/case.md @@ -31,14 +31,14 @@ else: proc positiveOrNegative(num: int): string = result = case num - of low(int)..-1: - "negative" - of 0: - "zero" - of 1..high(int): - "positive" - else: - "impossible" + of low(int)..-1: + "negative" + of 0: + "zero" + of 1..high(int): + "positive" + else: + "impossible" echo positiveOrNegative(-1) ``` @@ -63,4 +63,4 @@ of 10: echo "D" ``` console $ nimrod c -r ./case_stmts_1.nim C -``` \ No newline at end of file +``` diff --git a/content/hello_world.md b/content/hello_world.md index 4d31bb4..372aa0e 100644 --- a/content/hello_world.md +++ b/content/hello_world.md @@ -9,10 +9,10 @@ The code for a simple hello world program is as follows: echo "Hello World" ``` -To compile and execute the program, the following command should be run +Save this text as `helloworld.nim`. To compile and execute the program, the following command should be run ``` console -$ nimrod c -r --verbosity:0 ./helloworld.nim +$ nimrod c -r --verbosity:0 helloworld.nim Hello World ``` diff --git a/content/if_else_while.md b/content/if_else_while.md index cf97b78..6c0b544 100644 --- a/content/if_else_while.md +++ b/content/if_else_while.md @@ -4,7 +4,7 @@ title: If, Else, While # If, Else, While -Nimrod many different control flow constructs, including the standard `if`s, `else`s, and `while`s. However, Nimrod does not use an `else if` construct like many languages, it uses a more condensed `elif`. +Nimrod has many different control flow constructs, including the standard `if`s, `else`s, and `while`s. However, Nimrod does not use an `else if` construct like many languages, it uses a more condensed `elif`. When inside a loop, `continue` can be used to skip the rest of the loop body and to begin the next iteration; `break` can be used to immediately leave the loop body. @@ -31,4 +31,4 @@ block busyloops: while true: while true: break busyloops -``` \ No newline at end of file +``` diff --git a/content/primitives.md b/content/primitives.md index 9054823..58a3fda 100644 --- a/content/primitives.md +++ b/content/primitives.md @@ -8,9 +8,9 @@ Nimrod has several primitive types: * signed integers: `int8`, `int16`, `int32`, `int64`, and `int`, where `int` is the same size as a pointer * unsigned integers are similar with `u` prepended to the type * floating points numbers: `float32`, `float64`, and `float`, where `float` is the processor's fastest type -* characters: `char`, and basically an alias for uint8 +* characters: `char`, which is basically an alias for uint8 -To indicate the size of an integer literal, append `u` or `i` and the size you'd like to the end. However, this is not typically necessary. +To indicate the size of an integer literal, append `u` or `i` and the size you'd like to the end. However, usually this is not necessary. Integers can also have `0[xX]`, `0o`, `0[Bb]` prepended to indicate a hex, octal, or binary literal, respectively. Underscores are also valid in literals, and can help with readability. @@ -22,7 +22,7 @@ let c: uint8 = 256 # Compile time error ``` -Precedence rules are the same as most other languages, but instead of `^`, `&`, `|`, `>>`, `<<`, the `xor`, `and`, `or`, `shr`, `shl` operators are used, respectively. +Precedence rules are the same as in most other languages, but instead of `^`, `&`, `|`, `>>`, `<<`, the `xor`, `and`, `or`, `shr`, `shl` operators are used, respectively. ``` nimrod let @@ -34,4 +34,4 @@ echo 4/2 $ nimrod c -r numbers2.nim 2.0 ``` -Another difference that may be surprising is that the `/` operator returns a floating point result, even when the operands are integers. If integer division is needed, the `div` operator should be used. \ No newline at end of file +Another difference that may be surprising is that the `/` operator returns a floating point result, even when the operands are integers. If integer division is needed, the `div` operator should be used. diff --git a/content/variables.md b/content/variables.md index a25a49f..d05e918 100644 --- a/content/variables.md +++ b/content/variables.md @@ -57,4 +57,4 @@ A `const` variable's value will be evaluated at compile-time, so if you inspect STRING_LITERAL(TMP129, "abcdefghijklmnopqrstuvwxyz", 26); ``` -The only limitation with const is that compile-time evaluation cannot interface with C because there is no compile-time foreign function interface at this time. \ No newline at end of file +The only limitation with const is that compile-time evaluation cannot interface with C because there is no compile-time foreign function interface at this time. diff --git a/content/variables/result.md b/content/variables/result.md index dbd53c2..dfc249c 100644 --- a/content/variables/result.md +++ b/content/variables/result.md @@ -12,7 +12,7 @@ proc `**`(number, power: int): int = result *= number ``` -A possible gotcha is declaring a variable called result and expecting it to have the same semantics. +A possible gotcha is declaring a new variable called `result` and expecting it to have the same semantics. ``` nimrod proc unexpected(): int =