Skip to content

Commit

Permalink
More documentation for alt expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Oct 28, 2011
1 parent fd095fb commit ba1df0e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/rust.texi
Original file line number Diff line number Diff line change
Expand Up @@ -3402,6 +3402,17 @@ alt x @{
@}
@end example

Multiple alternative patterns may be joined with the @code{|} operator. A
range of values may be specified with @code{to}. For example:

@example
let message = alt x @{
0 | 1 @{ "not many" @}
2 to 9 @{ "a few" @}
_ @{ "lots" @}
@}
@end example


@node Ref.Expr.Alt.Type
@subsubsection Ref.Expr.Alt.Type
Expand Down

0 comments on commit ba1df0e

Please sign in to comment.