2 - Loops and iteration

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

12 Terms

1
New cards

loop

repeat a block of code multiple times without writing it again

2
New cards

process multiple items

repeat same task

unknown repetitions

why are loops useful?

3
New cards

condition-controlled loop

count-controlled loop

types of repetition structure

4
New cards

condition-controlled loop (while)

loop continues as long as the condition remains true.

5
New cards

count-controlled loop (for)

repeats a specific number of times

6
New cards

while loop

repeatedly executes a target statement as long as a given condition is true

7
New cards

for loop

runs a block of code a specific number of times or goes through every item in a sequence eq. string

8
New cards

break

continue

pass

loop control statements

9
New cards

break

immediately ends the loop, even if the condition/range isn't finished

10
New cards

continue

skips the current step and moves to the next one

11
New cards

pass

does nothing; used as a placeholder when you don't want any action yet

12
New cards

choose the right loop type

avoid infinite loops

keep it simple

best practices for loops