aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-03-16 22:28:00 -0400
committerGraydon Hoare <[email protected]>2011-03-22 08:11:36 -0700
commit5d98f55fcf0c88372101eb137e2cd1c75e00f1a2 (patch)
tree3b6d9fae67e0144557c800465ef8387a7d8b34c4
parentRemove usages of case(_) { fail; } since the compiler does this automatically (diff)
downloadrust-5d98f55fcf0c88372101eb137e2cd1c75e00f1a2.tar.xz
rust-5d98f55fcf0c88372101eb137e2cd1c75e00f1a2.zip
Update docs for if statements
-rw-r--r--doc/rust.texi13
1 files changed, 8 insertions, 5 deletions
diff --git a/doc/rust.texi b/doc/rust.texi
index 48a639dd..4b92fa94 100644
--- a/doc/rust.texi
+++ b/doc/rust.texi
@@ -3310,11 +3310,14 @@ for each (str s in _str.split(txt, "\n")) @{
An @code{if} statement is a conditional branch in program control. The form of
an @code{if} statement is a parenthesized condition expression, followed by a
-consequent block, and an optional trailing @code{else} block. The condition
-expression must have type @code{bool}. If the condition expression evaluates
-to @code{true}, the consequent block is executed and any @code{else} block is
-skipped. If the condition expression evaluates to @code{false}, the consequent
-block is skipped and any @code{else} block is executed.
+consequent block, any number of @code{else if} conditions and blocks, and an
+optional trailing @code{else} block. The condition expressions must have type
+@code{bool}. If a condition expression evaluates to @code{true}, the
+consequent block is executed and any subsequent @code{else if} or @code{else}
+block is skipped. If a condition expression evaluates to @code{false}, the
+consequent block is skipped and any subsequent @code{else if} condition is
+evaluated. If all @code{if} and @code{else if} conditions evaluate to @code{false}
+then any @code{else} block is executed.
@node Ref.Stmt.Alt
@subsection Ref.Stmt.Alt