0

Functions, loops, if statements

what situations are functions, loops, if statements used? are there situations where they could be used interchangeably?

15th Feb 2017, 12:29 PM
Mich
Mich - avatar
1 ответ
0
Functions serve to reuse the code. You can just copy and paste contents of a function where it is called and you will be fine. If statemens are used in control flow of a program, use them if you need one block of code executed but not the other. Loops are there to reapeat a certain action till a given codition is false. Generally you want to combine them, depending on a task that you have to write more efficent code.
15th Feb 2017, 12:48 PM
Kyle Butler
Kyle Butler - avatar