File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ fn f ( n : i32 ) {
2+ // ()-typed
3+ if n == 2 {
4+ }
5+ if n == 1 {
6+ } else if n == 2 {
7+ return ;
8+ } else {
9+ }
10+ // ()-typed (if let)
11+ if let 1 = n {
12+ } else if let 2 = n {
13+ return ;
14+ } else if n == 2 {
15+ return ;
16+ } else {
17+ }
18+ // simple if/else expression
19+ let y = if x == 5 { 5 } else { 10 } ;
20+ let z = Some ( 5 ) ;
21+ // if expression with an else if branch
22+ let y = if z. is_some ( ) {
23+ 30
24+ } else if z. is_none ( ) {
25+ 99
26+ } else {
27+ 0
28+ } ;
29+ // if expression with an else if let branch
30+ let y = if z. is_some ( ) {
31+ 30
32+ } else if let None = y {
33+ 99
34+ } else {
35+ 0
36+ } ;
37+ // if let expression with both kinds of else if
38+ let y = if let Some ( 3 ) = y {
39+ 30
40+ } else if let Some ( 4 ) = y {
41+ } else if y == Some ( 10 ) {
42+ 100
43+ } else {
44+ 0
45+ } ;
46+ // if and else-if with let-else chain
47+ if let Some ( 3 ) = y && let None = z {
48+ } else if let None = y && let Some ( _) = z {
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments