Mind map
Programming basics
Map content
Programming basics
Sub Programs
- Procedures are a set of instructuons stored under one name.
- Functions are similar to procedures - the main difference is that they always return a value
- Procedures and functions are very useful when you have a set of instructions that you need to repeat in different places within a program. They give your program more structure and readability whilst cutting down on the amount of code you need to write
- Parameters are a special variables used to pass values into a sub program. For each parameter you can specify a name, data type and a default value
- Arguments are the actual values and the parameters take when the sub program is called
Programming basics- data types
- Data types
- Integer- Whole numbers only. Pseudocode- INT
- Real (float)- Numbers that have a decimal point. Pseudocode- REAL
- Boolean- Can only take one of two values, usually TRUE or FALSE. Pseudocode- BOOL
- Character- A single letter, number or symbol. Pseudocode- CHAR
- String- Used to represent text, it is a collection of characters. Pseudocode- String
- Each data type is allocated a different amount of memory. Integer- 2 bytes or 4 bytes, Real- 4 bytes or 8 bytes, Boolean- 1 bit is needed but 1 byte is usually used, Character- 1 byte, String- 1 byte for every character in the string
- Languages hve functions that let you manually convert between data types - this is known as casting. This can be done using int(), bool(), and str() commands
- Data types
Programming basics- Operators
- Operators are special characters that perform certain functions.
- The arithmetic operators take two values and perform a math function on them. Addition, subtraction, multiplication and division operators do what you'd expect
- The exponentiation operator us used to raise a number to a power
- The DIV operator returns the whole number part of a division and the mod operator gives the remainder
- Computers follow the rules of BODMAS (Brackets, Other, Division, Multiplication, Addition and subtraction
- The assignment operator =, is used to assign values to constants or variables
- Comparison operators compare the expression of their left hand side to the expression on their right side and produce a Boolean value (TRUE or FALSE)
Constants and variables
- Data values can be stored as constants or variables.
- A constant is assigned to a data value at a design time that can't be changed. If you attempt to change the value of a constant in a program then the interpreter or compiler will return an error
- Variables on the other hand can change value which makes them far more useful than constants
- Constants and Variables often need to be declared at the start of a program before you can use them
Strings
- Strings are usally written inside double quotation marks but sometimes single quotes are used
- Strings can be joined together to form new strings - this is called concatenation. It is often done using the '+' operator
Program Flow
- The flow of a program is the order that the steps are carried out in. You can control flow using selection statements - these are two types you should learn, IF statements and CASE statements.
Information
- Description
- Mind Map on Programming basics, created by Lewis Evans on 06/06/2019.
- Created by
- Lewis Evans · Jun 2019
- Updated
- Jun 7, 2019
- Views
- 1
- Rating