to those about to rock...
Please see the appropriate section in the Slate programmer's manual for more details on control flow.
Boolean and Equality Operators
| Description | Selector | Example |
| And | /\ | x /\ y |
| Or | \/ | x \/ y |
| Not | not | x not |
| Boolean Equivalence | eqv: | x eqv: y |
| Exclusive Or | xor: | x xor: y |
| Greater-than | > | x > 10 |
| Less-than | < | 3 < y |
| Equals | = | x = 6 |
If Statements
There are several if operators supported in Slate: ifTrue:, ifFalse:, ifNil:, ifNotNil:.
Usage examples:
"Execute a block if the expression is true"
x = 10 ifTrue: [inform: 'x is equal to 10'].
"Execute a block if the expression is false"
y = 0 ifFalse: [inform: 'y is not equal to zero'].
The ifNil: and ifNotNil: operators work in a similar manner. Another very useful operator is ifNotNilDo: which passes its first argument to the block parameter:
(list at: index) ifNil: [...] ifNotNilDo: [| :item | item doSomething].
Case-switch
last updated 2 years ago
#