-
Notifications
You must be signed in to change notification settings - Fork 8
miscellaneous
Anobium edited this page Oct 18, 2020
·
1 revision
About Miscellaneous things….
It is possible to combine multiple instructions on a single line, by separating them with a colon. For example, this code:
Set PORTB.0 On
Set PORTB.1 On
Wait 1 sec
Set PORTB.0 Off
Set PORTB.0 Off
could also be written as:
Set PORTB.0 On: Set PORTB.1 On
Wait 1 sec
Set PORTB.0 Off: Set PORTB.0 Off
In most cases, it will make no difference if commands share a line or not. However, special care should be taken with If commands, as this code:
Set PORTB.0 Off
Set PORTB.1 Off
If Temp > 10 Then Set PORTB.0 On: Set PORTB.1 On
Wait 1 s
Will be equivalent to this:
Set PORTB.0 Off
Set PORTB.1 Off
If Temp > 10 Then
Set PORTB.0 On
Set PORTB.1 On
End If
Wait 1 s
Also, the commands used to start and end subroutines, data tables and functions must be alone on a line. For example, this is WRONG:
Sub Something: Set PORTB.0 Off: End Sub