Loop тізбек цикл iteration



Дата19.02.2020
өлшемі8,26 Mb.
#58421
Байланысты:
Loops.

Loops.

Discuss the following picture.

What is a ‘Loop’?

A loop is an order of instructions that

A loop is an order of instructions that

repeats for many times.

Each repetition is called an iteration of the loop.

Terminology PART

loop


тізбек

цикл

iteration


қайталау / итерация

повторение

divisible


бөлінетін

делимый

ascending


өсу

восходящий

counter


санауыш

счетчик

even


жұп

четные

odd


тақ

нечетные

to fix


түзету

исправлять

Coding for loops: Activity

Coding for loops: Activity

Types of Loops


For loop

While

do...while

Repeats a statement or group of statements until a given condition in use. It tests the condition BEFORE executing the body.

Execute the sequence of statements multiple times.

Like a while statement, except that it tests the condition at the END of the loop body.


Parts of a loop


Initialization Expression initializes the loop variables in the beginning of the loop.

Test Expression decides whether the loop will be executed (if test expression is true) or not (if test expression is false).

Update Expression updates the values of loop variables after every iteration of the loop.

The-Body-of-the-Loop contains statements to be executed repeatedly.

The syntax:

C++

Python

for value in sequence:



body of for

C++

Python

Mark Zuckerberg teaches Loops

Thanks!

Any questions?



Достарыңызбен бөлісу:




©engime.org 2024
әкімшілігінің қараңыз

    Басты бет