11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INSTRUCTOR NOTES 9 THE IF COMMAND UThe IF command is introduced in this lesson. The case where two strings are the same or ^not the same is treated. ^jIF is a powerful command which is at the very heart of the computer as a logic machine.It is an intricate command and the student may require extra help at this point. ^The IF command appeals to both our verbal and our visual imagination. The "cake" ^Jcartoon and the "fork in the road" cartoon illustrate these ideas. That the flow ofcommands may be altered has already been introduced with the GOTO command. To thatidea is now added the conditional test: if an expression is true, one thing happens; if it isfalse, another."Phrase A" is used for the assertion being tested for truth. The phrase "command C" is ^used for the command to be done if the assertion is true.Two levels of abstract ideas occur in the assertions. On the literal level we have "equal"and "not equal":A$ = B$C$ D$ ^The next level up we have the TRUTH or FALSITY of the assertion. ^Some care may be needed to separate and clarify these notions. When you see "A = B" it ^may not REALLY be true that A is equal to B because the assertion may actually beFALSE.The larger set of relations: = = Owill be treated in later lessons. ^^^J^^QUESTIONS:^1. How do you make this program print "THAT'S FINE"?15 PRINT "DOES YOUR TOE HURT?"17 INPUTT$ LJ20 IF T$="NAH" THEN GOTO 9040 IF T$="SOME" THEN GOTO 15 ^90 PRINT "THAT'S FINE" r.2. Write a short program which asks if you like chocolate or vanilla ice cream. Answers (jto be "C" or "V". For the "C" print "Yummy!" For the "V" answer, print "Mmmmmm!"3. What do we mean by "phrase A"?4. What do we mean by "command C"?5. Where is the "fork in the road" in an "IF" statement? Cj54

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

Saved successfully!

Ooh no, something went wrong!