0 = $false = $null for conditional expressions .. all fail.
!0 = $true = string .. all match the condition as not being false.
These are handy to use in several instances:
var %i = $nick($chan,0) | ; %i is the total number of nicks on $chan
;
; while we have not reached 0, process the nicks backwards
while (%i) {
; Do whatever you need to do in here
dec %i
}
The reverse is also handy when working backwards is not an option, such as if you're writing something to a file in order. You can, however, simply check to see if you've run past the end of whatever list you're working from, such as a nicklist or a list @window.
var %i = 1
; While there are more lines to write to the file, keep going.
while ($line(@ListWin,%i)) {
write ListWin.txt $ifmatch
inc %i
}
or
if (!%some.timed.variable) {
; !%variable means the logical opposite of that variable; either $true or $false, as described above.
;
; Do whatever needs to be done if the timed variable has:
; 1) expired or been /unset ($null)
; 2) been reduced to zero (0)
; 3) been set to $false ($false)
}
else {
; Update other stuff if it hasn't. (Anything else is a logical $true.)
}
Hopefully, these examples will help you to understand.