Rockwell-automation 1771-DB BASIC MODULE Bedienungsanleitung Seite 113

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 394
  • Inhaltsverzeichnis
  • FEHLERBEHEBUNG
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 112
Chapter
Expressions, Variables and Operators
9
9 -3
Eight types of operators may act on an expression:
G arithmetic G functional
G logical G logarithmic
G relational G string
G trigonometric G special function
An operator performs a defined operation on variables or constants.
Operators require either one (ex. SIN, COS, and ABS) or two operands
(ex. +, -,*, /).
You can write complex expressions using only a small number of
parentheses. An expression is scanned from left to right. Operators of the
higher precedence are performed before operators of lower precedence.
If the operators are of equal precedence they are performed as encountered
from left to right. The precedence of operators from highest to lowest:
1. Operators that use parentheses ( )
2. Exponentiation (**)
3. Negation (-)
4. Multiplication (*) and Division (/)
5. Addition (+) and Subtraction (-)
6. Relational Expressions (=, <>, >, >=, <, <=).
7. Logical AND (.AND.)
8. Logical OR (.OR.)
9. Logical XOR (.XOR.)
To illustrate the order of operations, examine this equation:
4+3*2
In this equation you cannot perform addition until the multiplication
operation is complete because multiplication has a higher precedence.
Therefore, multiply (3*2) and then add 4.
4+3*2 = 10
Important: Use parentheses if you are in doubt about the order of
precedence or to enhance program readability.
Order of Operations
Seitenansicht 112
1 2 ... 108 109 110 111 112 113 114 115 116 117 118 ... 393 394

Kommentare zu diesen Handbüchern

Keine Kommentare