Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF (EN)

122 26 Operator priority An operator is something like + , / , , etc, which affects one or more items – for example comparing them, or adding them. Mathematical operators are familiar. Most act on two numbers – for example 3+7 addition 2-5 subtraction 4*6 multiplication 1/9 division 7 DIV 4 integer division 7 MOD 4 integer remainder 3^4 raise to a power These operators are referred to as binary operators since they require two operands (ie two things to operate on). -5 This shows one of the few ‘unary’ operators that we are used to. The - just acts on the 5 to make it a negative number.

This version of BASIC has a large number of operators and it is very important that the user is aware of their order of priority. You will remember that in mathematics multiplication must be completed before addition. The same applies to other operators – there is a strict hierarchy and you must be aware of it if the computer is to do what you expect. The overall order of precedence for operators is as follows. Group 1 unary minus unary plus NOT functions parentheses ( ) indirection operators (see chapter 39) Group 2 ^ raise to the power Group 3 * multiplication / division DIV integer division MOD integer remainder