reword some of loops

This commit is contained in:
flaviut 2014-06-21 22:49:52 -04:00
commit c559b18f5a
3 changed files with 8 additions and 5 deletions

0
content/block.md Normal file
View file

View file

@ -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 ``` nimrod
import strutils import strutils

View file

@ -5,9 +5,10 @@
* [Variables](/variables/) * [Variables](/variables/)
* [Result](/variables/result/) * [Result](/variables/result/)
* [Type Casting and Inference](/variables/type_casting_inference/) * [Type Casting and Inference](/variables/type_casting_inference/)
* [If, Else, While, Block](/if_else_while/) * [If, Else, While](/if_else_while/)
* [Case Statements](/case/) * [Case Statements](/case/)
* [For Loops & Iterators](/for_iterators/) * [For Loops & Iterators](/for_iterators/)
* [Blocks](/block/)
* [Primitive Types](/primitives/) * [Primitive Types](/primitives/)
* [Types](/types/) * [Types](/types/)
* [Object Types](/types/objects/) * [Object Types](/types/objects/)