Programming concepts Flashcards
Programming data types
INTEGER STRING REAL CHAR BOOLEAN
INTEGER
Stores a whole number
STRING
Stores zero or more sequence of characters
REAL
Stores integers and numbers with a decimal part
CHAR
Stores a single character
BOOLEAN
Stores only 2 possible values
variable
named memory location that can store a value
value can change whilst the program is running
constant
named value
cannot change whilst program is running
Advantages of constants
- code will be easier to read and understand (constant’s identifier will be used instead of a number)
- you only have to edit in one place.
- value cannot be accidentally changed during the running of the program
counting
count the number of items in a list
incremented by 1
count ← count + 1
totalling
sum a list of numbers
each value is added to a running total
total ← total + value
sequencing
idea of one statement or instruction being executed one after another
selection
decides which statements are executed based on a condition
2 conditional statements(selections)
IF … THEN … ELSE … ENDIF
CASE … OF … OTHERWISE … ENDCASE
CASE … OF … OTHERWISE … ENDCASE
A statement that allows for multiple selections/deals with many possible outcomes
simplifies pseudocode and make it easier to read