Here - 1000 BiT

Here - 1000 BiT Here - 1000 BiT

11.07.2015 Views

(It is easy to remember that 0 is FALSE because zero is the grade you get if yourhomework is false.)To see these numbers, enter this in the edit mode:PRINT 3=7The computer checks to see if 3 really does equal 7. It doesn't so it prints a "0" meaningFALSE.and this: PRINT 3=3The computer checks to see if 3=3. It is, so the computer prints "-1" meaning TRUE.PUTTING TRUE AND FALSE INTO BOXESThe numbers for TRUE and FALSE are treated just like other numbers,stored in boxes with numeric variable names on the front. Run this:and can be10N=(3=22)20 PRINT NThe number 0 is stored in box N because 3=22 is FALSE.And this:10N="B"="B"20 PRINT NThe number -1 is stored in box N because the two letters in the quotes are the same sothe statement "B"="B" is TRUE.142

THE IF COMMAND TELLS LITTLE WHITE LIESThe IF command looks like this:10 IF (phrase A) THEN (command C)Try these in the edit mode:IF 0 THEN PRINT "TRUE"IF -1 THEN PRINT "TRUE"Now try this: IF 22 THEN PRINT "TRUE"RULE: In an IF, the computer looks at "phrase A."If it is zero, the computer says "phrase A is FALSE," and skips what is after THEN.If it is not zero, the computer says "phrase A is TRUE," and obeys the commandsafter THEN.The IF command tells little white lies. TRUE is supposed to be the number "-1", but theIF stretches the truth to say "TRUE is anything which is not FALSE," that is, anynumber which is not zero is TRUE.You tell aQhJF AND143

(It is easy to remember that 0 is FALSE because zero is the grade you get if yourhomework is false.)To see these numbers, enter this in the edit mode:PRINT 3=7The computer checks to see if 3 really does equal 7. It doesn't so it prints a "0" meaningFALSE.and this: PRINT 3=3The computer checks to see if 3=3. It is, so the computer prints "-1" meaning TRUE.PUTTING TRUE AND FALSE INTO BOXESThe numbers for TRUE and FALSE are treated just like other numbers,stored in boxes with numeric variable names on the front. Run this:and can be10N=(3=22)20 PRINT NThe number 0 is stored in box N because 3=22 is FALSE.And this:10N="B"="B"20 PRINT NThe number -1 is stored in box N because the two letters in the quotes are the same sothe statement "B"="B" is TRUE.142

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!