Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 3.22 KB

File metadata and controls

40 lines (31 loc) · 3.22 KB

1.2.1.5 PCEP-30-02 Practice Test Compendium – Operators

String operators (ordered according to descending priorities)

The rules governing the use of operators and parentheses remain the same, and left-sided binding is in effect.

Priority Operator Name Example Result Result type
Highest * Replication

'a' * 3
3 * 'a'

'aaa' Always a string
Middle + Concatenation

'a' + 'z'
'z' + 'a'

'az'
'za'

Always a string

Boolean operators (ordered according to descending priorities)

Boolean operators demand Boolean arguments, and always result in a Boolean result. The rules governing the use of operators and parentheses remain the same, including left-sided binding.

Priority Operator Name Example Result
Highest not negation not false True
not True False
Middle and conjunction False and False False
False and True False
True and False False
True and True True
Lowest or disjunction False or False False
False or True True
True or False True
True or True True

Relational operators

Relational operators compare their arguments to diagnose the relationship between them, and always return a Boolean value indicating the comparison result.

Operator Name Example Result
== equal to 2 == 1 False
!= not equal to 2 != 1 True
> greater than 2 > 1 True
>= greater or equal

2 >= 1
1 >= 1

True
True

< less than 2 < 1 False
<= less or equal

2 <= 1
1 <= 1

False
True