13.07.2015 Views

Turbo Basic

Turbo Basic

Turbo Basic

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

GOTO statementFunctionSyntaxRemarksSee AlsoExampleGOTO sends program How to the statement identified by label.GOTOlabelGOTO causes program How to shift unconditionally to the codeidentified by label.Used· in moderation, GOTOs are a fast and effective programmingdevice. Used carelessly, they can choke a' program withkudzu-like strands of code that can. be almost impossible to puzzleout (especially months and years after they are written). Modernprogramming practice minimizes GOTO usage with subroutines,procedures, and functions and structured statements such as FOR/NEXT, WHILE/WEND, DO/LOOP, IF BLOCK, and SELECT.The EXIT statement can also assist in GOTO reduction.EXITx = 0Start: I define a labelX = X + 1 I increment XIF X < 20 THEN I if X < 20 then jump the PrintOutGOTO PrintOutEND IFENDPrintOut: I display the value of XPRINT "Variable X = " XGOTO Start I jump back to Start<strong>Turbo</strong> <strong>Basic</strong> Reference Directory 219

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

Saved successfully!

Ooh no, something went wrong!