Are called by assigning their
return value to something
They always return a single value
Defines a large amount of
coding into one value
Useful to reuse code faster
Good so work can be split
between programmers
Variables
Values change throughout
the program
Constants
Stays fixed throughout the program
Used within subroutines
Both are used to store data whilst the program is running
SQL (Standard Query Language)
Programming language used
to work with databases
Can be run from a special
window in a database package
SQL Keywords
SELECT
The variable you want to find
FROM
From which database
e.g. To find a SongTitle
more than 3 mins long
SELECT SongTitle
FROM Songs
WHERE Length > 3
WHERE
Different columns
Iteration
The repetition of a process
For Counter (Counter-controlled)
Loops for a specific number of times,
depending on the counter number
While Loop (Condition-controlled)
Better for user interfaces
Loops until the condition is met/changes
Operators
Arithmetic Operators
/ - Division
* - Multiplication
+ - Addition
- - Subtraction
MOD - Modulus (Remainder)
e.g.12 MOD 5 = 2
DIV - Ouotient
e.g. 17 DIV 5 = 3
^ - Exponentiation
(To the power of)
Represents the operations that
are performed on the data
String Operators
(String Manipulation)
.length - Number of characters
in a string (including spaces)
.lower - lowercase
.upper - UPPERCASE
.substring (x,y) - Part of a string
Comparison
Operators
!= - Not equal to
== - Equal to
< - Less than
> - Greater than
<= - Less than or equal to
>= - Greater than or equal to
Logical Operators (Only
used in Booleans)
AND - Two conditions must be
met for the statement to be true
OR - At least one condition must be
met for the statement to be true
NOT - Inverts the results e.g. NOT(A and B) will
only be false when both A and B are true`
Arrays
Begins with 0
Usually have fixed sizes and occupy a
fixed (static) amount of memory
A table of organised data
Advantages
Non-sequential nature - can jump between non-neighbouring elements
instantly without having to browse through the whole array
Good for ease of iterating through an array - allows us to manipulate multiple times
of data with very few lines of code,replacing may separate variables
2D Arrays
Has rows and columns
Each individual rows/columns/index hold different series of data
1D Array
Only holds one series of data (like a pie chart)
Selection
Allows a computer to "think" - make decisions
Changes the flow of a program, depending on a set of conditions, it is
used for validation, calculation and making sense of a user's choices
e.g. IF, ELIF, ELSE, SELECT CASE statements
Nested Selection
Sometimes, we can only evaluate a condition if some pre-condition is met.
We would need two selection statements, one inside the other
The "outside" selection is the pre-condition,
while the "inside" selection is the conditon
e.g.
IF.......
IF
IF Statement within
an IF Statement
Sequencing
Allows a programmer to solve complex tasks through a
number of simple instructions (sequence/algorithm)
Advantages
Each line follows the next
Create simple programs very quickly
Easy to follow for a small program
Fundamental priniciple of a program
Starts at the top, finishes at the bottom
Disdavantages
Not at all efficient
Extremely hard to maintain
Becomes very difficult to
follow with large problems