From c559b18f5a7df7e2e0eb1b24ec9ab92396bf06df Mon Sep 17 00:00:00 2001 From: flaviut Date: Sat, 21 Jun 2014 22:49:52 -0400 Subject: [PATCH] reword some of loops --- content/block.md | 0 content/if_else_while.md | 10 ++++++---- content/toc.md | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 content/block.md diff --git a/content/block.md b/content/block.md new file mode 100644 index 0000000..e69de29 diff --git a/content/if_else_while.md b/content/if_else_while.md index 9b7600d..cf97b78 100644 --- a/content/if_else_while.md +++ b/content/if_else_while.md @@ -1,12 +1,14 @@ --- -title: If, Else, While, Block +title: If, Else, While --- -# If, Else, While, Block +# If, Else, While -Nimrod many different control flow constructs, including the standard `if`s, `else`s, and `while`s. +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`. -When inside a loop or block, it is possible to use `continue` or `break` any point, where `continue` skips to the next iteration and `break` ends the loop. The break statement can also receive the name of the block to break out of, so it is possible to break out of nested loops. +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. + +Along with [its other uses](/block/), the `block` statement can be used to create a label so that it's possible to break out of nested loops. ``` nimrod import strutils diff --git a/content/toc.md b/content/toc.md index 384e014..f6713d8 100644 --- a/content/toc.md +++ b/content/toc.md @@ -5,9 +5,10 @@ * [Variables](/variables/) * [Result](/variables/result/) * [Type Casting and Inference](/variables/type_casting_inference/) -* [If, Else, While, Block](/if_else_while/) +* [If, Else, While](/if_else_while/) * [Case Statements](/case/) * [For Loops & Iterators](/for_iterators/) +* [Blocks](/block/) * [Primitive Types](/primitives/) * [Types](/types/) * [Object Types](/types/objects/)