Zusammenfassung der Ressource
2.2 -
Programming
Techniques
- Variables
- Should not contain spaces and they
shouldn't start with a number.
- If the inputs come from the console, from
a file or from elsewhere in a modular
program.
- AKA parameters.
- Booleans
- And, or, not, larger, smaller, equal, not equal.
- String/characters
- Slicing, length, format.
- Modular division
- Finding a remainder.
- 5MOD2 would give 5.
- Integer division
- 5DIV2 would give 2
- Stores values whilst a
program is running.
- Values can change.
- String Features
- Slicing
- LEFT("Monkey") gives "Monk"
- Length
- LEN("Monkey") gives 6
- Change case
- Monkey ---> MONKEY ---> monkey
- Sequencing
- Allows a programmer to solve
complex tasks through a number of
simple steps.
- Benefits
- Each line follows the next.
- Creates simple programs very
quickly.
- Easy to follow for a small program.
- Fundamental principals of a program.
- Starts at the top, finishes at the bottom.
- Disadvantages
- Not at all efficient.
- Becomes very difficult to follow
with large programs.
- Extremely hard to maintain.
- Selection
- Changes the flow of a program,
depending on a set of decisions.
- Used for validation, calculation and
making sense of a user's choices.
- Nested Selection
- A statement within a statement.
- Constants
- Store values whilst
program is running.
- Values remain the same.
- Basic Programming Constructs
- Sequence
- Selection
- Iteration
- 2 dimensional array
- Has rows and columns.
- Each row/column/index
holds data.
- Features of a table
- Fieldname
- Title of each column.
- Primary Key
- A unique number to
identify an object.
- Record
- Each individual cell's data.
- Subroutines
- Can be repeated in different parts of code.
- Work can be split between programmers.
- Functions return a value.
- Procedures DO NOT
return a value.