Browse Source

Finished writing the Control Statements chapter

pull/1/head
Brett Langdon 14 years ago
parent
commit
063e5ec20c
2 changed files with 21 additions and 0 deletions
  1. +21
    -0
      3 - Functional Programming/1.2 - Control Statements.tex
  2. BIN
      Programming In General.pdf

+ 21
- 0
3 - Functional Programming/1.2 - Control Statements.tex View File

@ -380,3 +380,24 @@ This program will output \pigOut{Loop Started} followed by a listing of 0 throug
So as you can see unlike a Break statement which stops a loop in its tracks a Continue statement just says stop processing this iteration of the loop and continue to the next.
\subsection{Conclusion}
We have finished a substantial chapter so lets re-cap.
We have covered how to go about controlling the flow of our programs.
To make decisions based on the value of variables as well as to continue the execution of code until a given condition is met and even how to control those features.
\par
If, If-Else and Else-If statements allow us to use conditionals to perform given blocks of code given the output of the conditional.
\par
Switch statements are used to perform a given block of code given the specific value of a variable.
\par
For loops allow us to use a counter to execute a given block of code based on the size of the counter.
\par
While and Do-While loops allow us to execute a given block of code while a conditional evaluates to true.
A While loop checks the conditional before executing the code block while a Do-While will execute the code block first before checking the conditional.
\par
Lastly, we use Break and Continue statements to control our control statements.
A Break statement is used to break free from a loop and stop its execution.
A Continue statement allows a loop to skip to the next iteration.

BIN
Programming In General.pdf View File


Loading…
Cancel
Save