Skip to content

Commit ba1df0e

Browse files
committed
More documentation for alt expressions
1 parent fd095fb commit ba1df0e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/rust.texi

+11
Original file line numberDiff line numberDiff line change
@@ -3402,6 +3402,17 @@ alt x @{
34023402
@}
34033403
@end example
34043404

3405+
Multiple alternative patterns may be joined with the @code{|} operator. A
3406+
range of values may be specified with @code{to}. For example:
3407+
3408+
@example
3409+
let message = alt x @{
3410+
0 | 1 @{ "not many" @}
3411+
2 to 9 @{ "a few" @}
3412+
_ @{ "lots" @}
3413+
@}
3414+
@end example
3415+
34053416

34063417
@node Ref.Expr.Alt.Type
34073418
@subsubsection Ref.Expr.Alt.Type

0 commit comments

Comments
 (0)