From 91d57e4e774da5ff9d79570e0f32ba4cdaf8660f Mon Sep 17 00:00:00 2001 From: Daniel Kullmann Date: Sun, 11 Jan 2015 00:34:32 +0100 Subject: [PATCH] Mention other possibilities to introduce blocks The original text only mentions the block statement and parentheses. But many other statements can use blocks, e.g. if, for, while. --- content/block.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/content/block.md b/content/block.md index fb1df19..05e591b 100644 --- a/content/block.md +++ b/content/block.md @@ -4,9 +4,22 @@ title: Blocks # Blocks -There are two ways to introduce a block, with the `block: ` statement or with `()`s. +Blocks can be introduced in two different ways: by indenting statements or with `()`s. -The block statement can also be labeled, making it useful for breaking out of loops and is useful for general scoping as well. +The first way ist to use indenting, e.g. using `if-elif-else`, `while`, `for` statements, or the `block` statement. + +``` nimrod +if true: + echo "Nimrod is great!" + +while false: + echo "This line is never output!" + +block: + echo "This line, on the other hand, is always output" +``` + +The `block` statement can also be labeled, making it useful for breaking out of loops and is useful for general scoping as well. ``` nimrod block outer: