Re: Gotos

 BBS: Inland Empire Archive
Date: 04-07-92 (16:38)             Number: 167
From: ROBBIE CHURCH                Refer#: 124
  To: JEFF HOWARD                   Recvd: NO  
Subj: Re: Gotos                      Conf: (2) Quik_Bas
JH>  non-basic psudo-code to edit DESC field

JH>  DESC:                                   'psudo-code
JH>    GetCons temp$
JH>                  'The GetCons Routine should replace
JH> BASIC's INPUT and exit
JH>                  'when the ESC key or an extended key has been pressed,
JH>                  'resultant is placed into temp$
JH>    if temp$ is Esc then EXIT ROUTINE
JH>    if temp$ is UpArrow and item% <> 0 then
JH>      item% = item% - 1
JH>      goto DESC
JH>    if temp$ is RightArrow then goto PRICE
JH>    if temp$ is DownArrow
JH>      item% = item% + 1
JH>      goto DESC
JH>    if temp$ is LeftArrow and item% > 0 then
JH>      item% = item% - 1
JH>      goto QTY
JH>    process desc$(item%)

   That's fine, but the same thing can be accomplished just as easily with
   SELECT CASE and a DO/LOOP.  Once you get used to using structured type
   commands GOTOS become entirely unnecessary.

   DO
      GetCon Temp$

      SELECT CASE Temp$
         CASE ESC
            EXIT DO
         CASE UpArrow
            IF item% <> 0 THEN
               item% = item% - 1
            END IF
         CASE RightArrow
            Price
         CASE DownArrow
            item% = item% + 1
         CASE LeftArrow
            IF item% > 0 THEN
               item% = item% - 1
            END IF
         END SELECT

         Process Desc$
      LOOP


 * SLMR 2.1a * The one who dies with the most taglines wins!!!

--- Maximus 2.01wb
 * Origin: Mostly Mail (1:105/319)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET