1.2. Definitions#
1.2.1. Objectives#
To learn the key terms used to understand programming.
1.2.2. Previous Terms#
Hardware: The physical components of a computing system.
Computer: A machine that stores and manipulates information under the control of a changeable program.
Program: A detailed set of instructions for a computer to execute.
Programming: The process of creating a computer program to solve a specific problem.
Programming Language: A notation used for writing computer programs, often referring to high-level languages like Python, Java, C++, etc.
High-level Language: A programming language that is readable by humans.
Low-level Language: A programming language with fewer abstractions than a high-level language, requiring more explicit instructions.
Machine Language: The lowest-level programming language, consisting of binary instructions that the CPU can execute directly. These instructions control operations such as storing, accessing, or writing data into memory, as well as performing computations.
1.2.3. New Terms#
Syntax: A set of rules that define the structure of valid statements, expressions, and programs in a programming language. More specifically, it dictates the correct arrangement of operators and operands.
Operator: Symbols that perform specific operations, such as mathematical, logical, bitwise, string manipulation, or assignment operations.
Operand: A value, variable, or expression that an operator acts upon.
Expression: A combination of operators and operands that returns a value. An expression can also consist of a single operand, such as a literal or variable.
Statement: A single command in a programming language that performs an action, such as assigning a value, printing output, or controlling program flow.
The syntax of a computer language consists of a set of rules that guide how operators and operands can be combined to form valid expressions.
1.2.4. Example#
In the above expression:
3
is an operand.+
is an operator.4
is an operand.The entire combination is called an expression.
The expression 3 + 4
is evaluated to 7
. When an expression is evaluated, it produces a single value.
Operands can be values or other expressions.In the above expression:
2
is an operand.-
is an operator.(3 / 5)
is an operand, which itself is an expression—a valid arrangement of operands and an operator.
Expressions do not always require an operator.In this case, 212
is a valid expression called a “literal expression” because it consists of a single literal value and evaluates to itself.