11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

LESSON 9 THE IF COMMANDClear the memory and enter10 PRINT "clr"20 PRINT "ARE YOU HAPPY? (YES OR NO)"30 INPUT A$40 IF A$="YES" THEN PRINT "I'M GLAD"50 IF A$="NO" THEN PRINT "TOO BAD"Run the program several times. Try answering "YES", "NO" or "MAYBE".What happens?YESNOMAYBETHE IFSTATEMENTThe IF statement has two parts:10 IF phrase A THEN command CFirst the computer looks at "phrase A".If it is true, the computer does the command C.If "phrase A" is not true, then the computer goes on to the next line without doing thecommand C.It looks like this:10 IF phrase A is true THEN do command Cand then go on to the next lineor10 IF phrase A is false THENgo on to the next lineAssignment 9A:1. Clear memory and write a program which asks if the user is a "BOY" or "GIRL". Ifthe answer is "BOY", the program prints "SNIPS AND SNAILS". If the answer is"GIRL", print "SUGAR AND SPICE".55

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

Saved successfully!

Ooh no, something went wrong!