Programming - Loops
Programming - Loops
(Loops statements)
Syntax:
For controlvariable = 1 to N do
Statement(s)
endfor
E.g.
For gender=male do
NAF = AF GenderDiscount
endfor
Syntax:
While <condition> do
Statement(s)
Endwhile
E.g.
While gender <> do
NAF = AF GenderDiscount
endwhile
Initialization
Repetitive statement
Loops statements (block)
Conclusion
Syntax:
Sum = Sum + New_number
Each time a new number is given (inputted)
it is added to sum.
E.g.
Counter = Counter + 1
Counter = Counter + 5
1.
2.
3.
4.
5.
6.
7.
8.