Skip to content

Commit 5d98f55

Browse files
brsongraydon
authored andcommitted
Update docs for if statements
1 parent 92a716d commit 5d98f55

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

doc/rust.texi

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3310,11 +3310,14 @@ for each (str s in _str.split(txt, "\n")) @{
33103310

33113311
An @code{if} statement is a conditional branch in program control. The form of
33123312
an @code{if} statement is a parenthesized condition expression, followed by a
3313-
consequent block, and an optional trailing @code{else} block. The condition
3314-
expression must have type @code{bool}. If the condition expression evaluates
3315-
to @code{true}, the consequent block is executed and any @code{else} block is
3316-
skipped. If the condition expression evaluates to @code{false}, the consequent
3317-
block is skipped and any @code{else} block is executed.
3313+
consequent block, any number of @code{else if} conditions and blocks, and an
3314+
optional trailing @code{else} block. The condition expressions must have type
3315+
@code{bool}. If a condition expression evaluates to @code{true}, the
3316+
consequent block is executed and any subsequent @code{else if} or @code{else}
3317+
block is skipped. If a condition expression evaluates to @code{false}, the
3318+
consequent block is skipped and any subsequent @code{else if} condition is
3319+
evaluated. If all @code{if} and @code{else if} conditions evaluate to @code{false}
3320+
then any @code{else} block is executed.
33183321

33193322
@node Ref.Stmt.Alt
33203323
@subsection Ref.Stmt.Alt

0 commit comments

Comments
 (0)