while, break, and the infinite loop AI ships — step 9 of 9
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Last one. Cursor wrote a "find the first match" loop that walks through a
list of usernames and stops as soon as it finds one starting with "a".
Two things are broken: the loop variable never advances (so it'll loop
forever on the first name), and the break is missing — even if the loop
did advance, it would scan past the first match.
Fix both bugs so the script prints found: alex.
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Last one. Cursor wrote a "find the first match" loop that walks through a
list of usernames and stops as soon as it finds one starting with "a".
Two things are broken: the loop variable never advances (so it'll loop
forever on the first name), and the break is missing — even if the loop
did advance, it would scan past the first match.
Fix both bugs so the script prints found: alex.
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.