Changeset 4c5ce70
- Timestamp:
- Mar 11, 2026, 5:44:52 PM (2 days ago)
- Branches:
- master
- Children:
- a783c74
- Parents:
- 42bce4e
- Location:
- tests/ctrl-flow
- Files:
-
- 2 edited
-
.expect/loop_else.txt (modified) (1 diff)
-
loop_else.cfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/ctrl-flow/.expect/loop_else.txt
r42bce4e r4c5ce70 69 69 (10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1)(0 0)else 70 70 71 before begin else after 71 before 72 begin 73 else 74 after 75 key 11 not found at position 10 76 key 11 not found at position 10 -
tests/ctrl-flow/loop_else.cfa
r42bce4e r4c5ce70 123 123 sout | nl; 124 124 125 sout | nlOn; // turn on auto newline 126 125 127 // A break (or a continue) in an else clause should target an outer loop. 126 128 … … 136 138 sout | " end"; 137 139 } 138 sout | " after" | nl; 140 sout | " after"; 141 142 // A loop index for while and for is accessible in the else clause. 143 // Do-while has no local declarations in condition. 144 145 int key = 11, size = 10, arr[size] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; 146 while ( int i = 0; i < size ) { 147 if ( arr[i] == key ) sout | "key" | key | "found at posstion" | i; 148 i += 1; 149 } else sout | "key" | key | "not found at position" | i; 150 151 for ( i; size ) { 152 if ( arr[i] == key ) sout | "key" | key | "found at posstion" | i; 153 } else sout | "key" | key | "not found at position" | i; 139 154 }
Note:
See TracChangeset
for help on using the changeset viewer.