Instruction involve:
- Create Variables
- Get user input from the keyboard
- Investigate memory addresses of variables
- Choose the best data type for the job
- Create and work with arrays
- Create and use functions
- Perform Binary Arithmetic / Logic operations
- Construct Expressions with a variety of operators
Statements can be broken into a number of categories:
- Declarations: Creation of variables.
- Assignments: Define a data-type value, defined by an expression, with a variable.
- Conditionals: Selectively execute blocks of statements depending on the evaluation of a binary arithmetic expression.
- Looping Structures: Repetitively execute a block of statements while a binary arithmetic expression returns true.
- Function Calls and Returns: Jump to a set of statements at another location in the program by calling a function, then jump back by the return statement.
Here, We will start off by considering two types of structures: Declarations, and Assignments.
Declarations
- A variable is made up of an identifier, pointer, data type and value.
- A declaration is a statement which associates a data type and identifier to a variable.
- In many programming languages, it is necessary to precede the assignment of a value to a variable with a declaration statement, which would prepare (or initialize) the variable to be ready to receive data.
- In Python, however, variables are automatically initialized when first used.
Assignments
- An assignment statement takes an initialized variable, and associates a value of a data type to the variable of the same data type.
- This is done using an expression with the assignment operator “=”.
- Example: int a = 20;