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.

Line 30 says that 5 + 2 is greater than 9 + 2. That is, 7is greater than 11. That is false.After reading line 20, the computer will store a 1 in Bsince the statement is true. Upon reading line 30, thecomputer will store a zero in C since the statement isfalse.As action drops to line 40, the computer will find the1 it stored in B and, thus, complete the action called for atthe right-hand end of line 40. It will display the message,"B OKAY."At line 50, however, the computer will find "nothing"(zero) in C and will not complete the right-hand end of thatinstruction. It only will do the right-hand end if it findssomething in the left-hand end.These logic functions are great for quick tests.Program Listing10 CLS20 LET B=(6+8)>(3*4)30 LET C=(5+2)>(9+2)40 IF B THEN PRINT "B OKAY"50 IF C THEN PRINT "C OKAY"50 Above & Below a LineHere's a way to count numbers above and below acut-off line. The computer solicits numbers between 1and 100. Any numbers you key in which are below 1 orabove 100 are trapped out by line 40. Entering a zeroends the input cycle.Line 50 counts the total numbers. Line 60 counts onlythose numbers between 1 and 50. Line 80 counts thenumbers from 51 to 100. Lines 90 to 130 present results.Program Listing10 GOTO 16020 PRINT "GIVE ME A NUMBER ";69

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

Saved successfully!

Ooh no, something went wrong!