CSCI 1105 Lecture Notes - Lecture 7: Lexicographical Order, Pseudocode, Boolean Data Type
CSCI 1105 verified notes
7/25View all
Document Summary
Allows a program to carry out different actions depending on the nature of the data which is to be processed. Uses rational operators, such as: < <= > >= == !=, to compare numbers and strings. Multiple if statements can be combined to evaluate complex decisions. You can nest an if inside either branch (if, else) of an if statement. Can be visualised in a flow chart, if you like: which can be helpful if you have a nested if statement, as there can be many outcomes to consider. Usually initialised and declared right at the top of the code. In case we need to change it, it will be easily accessible. Used throughout the code to represent one value. Create a table of key variables you want to be checking. Can work with pseudocode or with code: write it out with a pen or pencil, write it as comments in your code (save a tree!)