12.07.2015 Views

page-1983-101-timex-sinclair-programming-tricks

page-1983-101-timex-sinclair-programming-tricks

page-1983-101-timex-sinclair-programming-tricks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Program Listing10 PRINT •WHAT IS THE PERCENTAGE ?"20 INPUT P30 LET D=O.Ol*P40 PRINT •THE DECIMAL IS •;n50 PRINT60 CLEAR70 GOTO 1049 Logic FunctionsYou can make your computer do things based on itsdecision that something exists. That is, in the first programlisting here, it only will print the value of C if it findsthat B has an existing value. If Bis found to have no value,does not exist, C will not be printed.The decision is in line 40. The machine only prints Cif B does not equal zero. Since, in line 20, we set B = 10,the computer will find that something exists in B and,thus, go ahead and do the work assigned in the last half ofline 40. If nothing had been stored in B, the last half of line40 would have been ignored.Program Listing10 CLS20 LET B=lO30 LET C=lO*B40 IF B THEN PRINT CIn the second program here, the TIMEX only displaysthe results of the tests in lines 40 and 50 if the results ofone or both is "true."By doing the simple math in your head, you can seethat the information in the right-hand side of line 20 istrue. The information in the right-hand side of line 30 isfalse.Line 20 says that 6 + 8 is greater than 3 times 4. Thatis, 14 is greater than 12. That is true.68

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

Saved successfully!

Ooh no, something went wrong!