NASutils Knowledge BaseUnofficialPolski

BASIC · lesson 8 of 30 · Decisions and loopsJoin conditions

and, or and not join conditions. A condition is a number: 1 is true, 0 is false.

Programming on the NAS › BASIC in 30 lessons

08-conditions.yab Download 08-conditions.yab

free = 12
backup_ok = true
day$ = "Sunday"

if free < 20 and not backup_ok print "Space is low and the backup failed"
if free < 20 and backup_ok print "Space is low, the backup is fine"
if day$ = "Saturday" or day$ = "Sunday" print "It is the weekend"
if day$ <> "Monday" print "It is not Monday"

rem A condition is a number: 1 is true, 0 is false
print "free < 20 is ", free < 20

Terminal

$ yabasic 08-conditions.yab
Space is low, the backup is fine
It is the weekend
It is not Monday
free < 20 is 1

Exercise

Print "backup time" only on a weekday with more than 20 percent free.