Changeset 4c5ce70 for tests/ctrl-flow/loop_else.cfa
- Timestamp:
- Mar 11, 2026, 5:44:52 PM (6 days ago)
- Branches:
- master
- Children:
- a783c74
- Parents:
- 42bce4e
- File:
-
- 1 edited
-
tests/ctrl-flow/loop_else.cfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.