A data type determines what data can be stored in a variable and how it should behave
An integer stores positive and negative whole numbers
A float or real can store positive and negative fractional numbers as well as integers
A string stores any sequence of alphanumeric characters
A character or char stores any single alphanumeric character
A date/time data type stores dates and/or times in accordance with the real-world calendar
A Boolean data type holds a Boolean value of true or false, typically represented as a 1 or 0
A record can store various data of differing data types using named fields
An array is a sequence of elements of the same data type with a fixed size
A list is a sequence of elements of the same data type with an undefined size
A pointer/reference stores a variable that points to an address in memory
User-defined data types are data types constructed by the user. They can be more complex and have many uses such as creating records.
Assignment occurs when a variable is given a new value
All coding statements fall into one of three programming constructs: sequence, selection and iteration
Sequence means the code is executed one line at a time in order
Selection occurs when different code is executed according to conditions, allowing the program to branch (make choices)
Iteration is when a group of statements is repeated multiple times (looping)
In a count-controlled loop, instructions are repeated for a fixed number of times declared at the start of the loop. This is called definite iteration
In a condition-controlled loop, instructions are repeated until a condition is met, defined either at the start or the end of the loop. This is called indefinite iteration
An exit condition at the start of the loop means it may execute 0 or more times
An exit condition at the end of the loop means it may execute 1 or more times
Nested statements allow selection and iteration to occur within other selection and iteration statements
A subroutine is a section of code that can have parameters passed into it, and be called and reused multiple times throughout a program
A procedure is a subroutine that executes code but does not return a value
A function is a subroutine that executes code and then returns a value
An identifier is a name given to an entity in a programming language, such as to a variable or data type
Sensible identifier names should be used to make your code easy to read and understand
A variable is a named location in memory
The contents of a variable can change while the program is running
The contents of a constant cannot change while the programming is running and can only be altered in the code
Several mathematical operations can be performed on integers and floats
To always round up, use Math.Ceiling
To always round down, use Math.Floor
Mod or modulo returns the remainder in a division operation. In C# this is done using the operator %
Integer division returns an integer from any division operation, discarding any remainders
= is used for assignment. == is used for comparisons.
^ is the exponentiation symbol, used to raise numbers to a power. In C#, this can be done using Math.Pow
NOT is a logical operator that reverses a Boolean value
AND is a logical operator that only returns true if both inputs are true
OR is a logical operator that returns true if at least one input is true