of any type. It can also be a combination of constants and variables with arithmetic, relational or logical operators designed to produce a single value. How operators work is explained below. Expressions can be separated into two classes:
Expressions are normally thought of as having two or more data items called operands. Each operand is separated by a single operator to produce the desired result. This is usually done by assigning the value of the expression to a variable name. All of the examples of constants and variables that you've seen so for, were also examples of expressions.
An operator is a special symbol the BASIC Interpreter in your Commodore 64 recognizes as representing an operation to be performed on the variables or constant data. One or more operators, combined with one or more variables and/or constants form an expression. Arithmetic, relational and logical operators are recognized by Commodore 64 BASIC.
Arithmetic expressions, when solved, will give an integer or floating- point value. The arithmetic operators (+, -, *, /, ^) are used to perform addition, subtraction, multiplication, division and exponentiation operations respectively.
An arithmetic operator defines an arithmetic operation which is per- formed on the two operands on either side of the operator. Arithmetic operations are performed using floating-point numbers. Integers are converted to floating-point numbers before an arithmetic operation is performed. The result is converted back to an integer if it is assigned to an integer variable name.
ADDITION (+): The plus sign (+) specifies that the operand on the right is added to the operand on the left.
|This page has been created by Sami Rautiainen.|
|Read the small print.||Last updated November 13, 1998.|