Programming Techniques Flashcards
Variable
A named location in memory that holds data. The data can be changed while the program is running.
Constant
A named location in memory that holds data. The data can not be changed while the program is running.
Using constants make programs easier to maintain as humans find it easier to type words than numbers (eg pi instead of 3.14159265). These can be set once in the code and then used throughout.
If the value needs to be changed it only has to be changed where it is set and the new value will be used throughout.
Casting
Changing the data type of a variable. Eg changing an integer into a string so that it can be displayed within a message.
Concatenation
Joining strings together.
Selection
Some lines of code are run, and others not, depending on a condition.
Sequence
All lines of code are run in the order in which they are presented.
Iteration
Some (or all) lines of code are repeated either a set number of times or until a condition has been met.