Posts

Showing posts from October, 2018

Program Control: Repetition

Repetition Definition Repetition means one or more instruction repeated for a certain amount of time . Repetitions can be predefined in the program or can be defined later at run time examples of repetition/looping operation: for , while , and do-while. The C programming language still features the old fashioned go to command but is rarely used due to it being used resulting in a messed up code or in other words spaghetti code. FOR the for command syntax is for( initialization; conditional; increment or decrement ) {           statement1;           statement2; WHILE the while command   syntax is while (exp){        statement1;        statement2; } the exp is a boolean expression meaning will only result to true or false. Statement will be executed while  exp is true. The exp evaluation is done before the statements executed . DO-WHILE the do-while...