Computer Languages
|
The 'IF' key word is used to check a condition. The result determines what to do next in the program. Below is the part of a program which changes the value of a variable called 'toggle'. IF toggle is '1' THEN toggle is given the value '0' or ELSE toggle is given the value '1'.
In effect the value of toggle changes between 'true' (=1) and 'false' (=0) every time this piece of code is used. The syntax of the code will vary between programming languages so this general purpose example could be called 'pseudo code'.
|