goto, cls, wait commands

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James

    #16
    Re: goto, cls, wait commands

    On Windows, I use WConio


    It provides other screen functions you might have gotten used to in
    QBasic as well.

    On unix/cygwin, use curses.

    I am not aware of any portable library though.
    I used to use cls a lot in my QBasic days. Now I just don't.

    Comment

    • Dan Bishop

      #17
      Re: goto, cls, wait commands

      Harlin wrote:[color=blue]
      > No goto needed. If this makes no sense (which it may not if all[/color]
      you've[color=blue]
      > been exposed to is BASIC) it wouldn't be a bad idea to Google why you
      > should never use a goto statement.[/color]

      "GOTO" isn't even needed in QBasic (except for "ON ERROR GOTO").

      Comment

      • jean-michel

        #18
        Re: goto, cls, wait commands

        "BOOGIEMAN" <BOOGIEMANPN@YA HOO.COM> a écrit dans le message de
        news:1ixbe7q69l ob3.1npuu3z54gx 8z.dlg@40tude.n et...[color=blue]
        > I've just finished reading Python turtorial for non-programmers
        > and I haven't found there anything about some usefull commands I used in
        > QBasic. First of all, what's Python command equivalent to QBasic's "goto"[/color]
        ?[color=blue]
        > Secondly, how do I clear screen (cls) from text and other content ?
        > And last, how do I put program to wait certain amount of seconds ?
        > If I remeber correctly I used to type "Wait 10" and QBasic waits
        > 10 seconds before proceeding to next command.[/color]

        Hi all,
        I saw a lot of comments saying GOTO is not usefull, very bad, and we
        should'nt use it because we don't need it.
        I think that's true, but only if you *create* programs.
        But if the goal is to provide some kind of converter to automatically take
        an old application written with an old language (using GOTO), and generating
        python code, it would certainly a great help to have this (unclean) feature
        in native python.
        Best regards
        jm


        Comment

        • Nick Craig-Wood

          #19
          Re: goto, cls, wait commands

          Grant Edwards <grante@visi.co m> wrote:[color=blue]
          > I forgot to mention try/except. When I do use goto in C
          > programming it's almost always to impliment what would have
          > been a try/except block in Python.[/color]

          Yes I'd agree with that. No more 'goto out'.

          There is this also

          for (i = 0; ...)
          {
          if (something)
          goto found;
          }
          /* do stuff when not found */
          found:;

          (yes I hate setting flags in loops ;-)

          This translates exactly to the for: else: construct

          for i in xrange(...):
          if something:
          break
          else:
          # do stuff when not found

          The last language I saw with this very useful feature was FORTH in
          about 1984!

          --
          Nick Craig-Wood <nick@craig-wood.com> -- http://www.craig-wood.com/nick

          Comment

          • Jeff Shannon

            #20
            Re: goto, cls, wait commands

            jean-michel wrote:
            [color=blue]
            > Hi all,
            > I saw a lot of comments saying GOTO is not usefull, very bad, and we
            > should'nt use it because we don't need it.
            > I think that's true, but only if you *create* programs.
            > But if the goal is to provide some kind of converter to automatically take
            > an old application written with an old language (using GOTO), and generating
            > python code, it would certainly a great help to have this (unclean) feature
            > in native python.[/color]

            But an automatic translator is certain to be imperfect. One can no
            more translate mechanically between computer languages than one can
            translate mechanically between human languages -- and we've all seen
            the fun that can be had by machine-translating from language A ->
            language B -> language A, right? What do you think the effect of that
            sort of meaning-drift would be on application code?

            In other words, any translation from one language to another will
            require significant human attention, by someone familiar with both
            languages, to ensure that the original meaning is preserved as close
            as possible. You're going to have to rewrite chunks of code by hand
            no matter what you do; it'd be silly to *not* take that opportunity to
            purge things like GOTO.

            Jeff Shannon
            Technician/Programmer
            Credit International

            Comment

            • jean-michel

              #21
              Re: goto, cls, wait commands


              "Jeff Shannon" <jeff@ccvcorp.c om> a écrit dans le message de
              news:110q581gre o8g9e@corp.supe rnews.com...[color=blue]
              > jean-michel wrote:
              >[color=green]
              > > Hi all,
              > > I saw a lot of comments saying GOTO is not usefull, very bad, and we
              > > should'nt use it because we don't need it.
              > > I think that's true, but only if you *create* programs.
              > > But if the goal is to provide some kind of converter to automatically[/color][/color]
              take[color=blue][color=green]
              > > an old application written with an old language (using GOTO), and[/color][/color]
              generating[color=blue][color=green]
              > > python code, it would certainly a great help to have this (unclean)[/color][/color]
              feature[color=blue][color=green]
              > > in native python.[/color]
              >
              > But an automatic translator is certain to be imperfect. One can no
              > more translate mechanically between computer languages than one can
              > translate mechanically between human languages -- and we've all seen
              > the fun that can be had by machine-translating from language A ->
              > language B -> language A, right? What do you think the effect of that
              > sort of meaning-drift would be on application code?
              >
              > In other words, any translation from one language to another will
              > require significant human attention, by someone familiar with both
              > languages, to ensure that the original meaning is preserved as close
              > as possible. You're going to have to rewrite chunks of code by hand
              > no matter what you do; it'd be silly to *not* take that opportunity to
              > purge things like GOTO.
              >
              > Jeff Shannon
              > Technician/Programmer
              > Credit International
              >[/color]

              The automated translations are very commonly used actually in computing
              industry. If you want an overview, you can try "legacy migration" in google
              for instance (or "as400 automated migration" or anything of that kind).
              Translate a computer's language is not the same at all than to translate a
              human language. In the first case, you have a good chance to know all the
              rules. Even if the work is not perfect, it can offer you a chance to
              continue to use a 10000 programs application without having to rewrite all
              (several years of work indeed).
              The last time I did that, I converted arround 6000 cobol programs in a
              couple of months, which is obviously not possible by hand (thanks to python
              ;-). And it was not possible to remove GOTO, because that would really need
              to rewrite manually the programs, that means to entirely redo the
              application (probably a 20 human years work !).

              Regards,
              jm


              Comment

              • Fredrik Lundh

                #22
                Re: goto, cls, wait commands

                "jean-michel" <nospam@nospam. fr> wrote:
                [color=blue]
                > And it was not possible to remove GOTO, because that would really need
                > to rewrite manually the programs[/color]

                really? converting GOTO messes to structured programs has been a solved
                problem for many years (you can buy commercial products that does this, and
                I don't think they come with programmers in the box)

                </F>



                Comment

                • Mike Meyer

                  #23
                  Re: goto, cls, wait commands

                  Alan Kennedy <alanmk@hotmail .com> writes:[color=blue][color=green]
                  >> Secondly, how do I clear screen (cls) from text and other content ?[/color]
                  >
                  > That depends on
                  >
                  > A: What type of display device you're using
                  > B: What type of interface is being rendered on that display (command
                  > line, GUI, IDE, etc)
                  > C: Perhaps what operating system you are using.[/color]

                  D: Whether or not you have a display device at all. I run Python
                  scripts from Cron whose sole output functionality is via email. I run
                  Python scripts as daemons whose sole output functionality is syslog.

                  "Clear screen" doesn't make sense in thsoe two contexts.

                  <mike
                  --
                  Mike Meyer <mwm@mired.or g> http://www.mired.org/home/mwm/
                  Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

                  Comment

                  • Fredrik Lundh

                    #24
                    Re: goto, cls, wait commands

                    Mike Meyer wrote:
                    [color=blue][color=green][color=darkred]
                    >>> Secondly, how do I clear screen (cls) from text and other content ?[/color]
                    >>
                    >> That depends on
                    >>
                    >> A: What type of display device you're using
                    >> B: What type of interface is being rendered on that display (command
                    >> line, GUI, IDE, etc)
                    >> C: Perhaps what operating system you are using.[/color]
                    >
                    > D: Whether or not you have a display device at all. I run Python
                    > scripts from Cron whose sole output functionality is via email. I run
                    > Python scripts as daemons whose sole output functionality is syslog.[/color]

                    are you the original poster? if so, can you explain why you asked
                    how to clear the screen if you don't have a screen?

                    </F>



                    Comment

                    • Erik  Bethke

                      #25
                      Re: goto, cls, wait commands

                      At least I thought this was funny and cool! -Erik

                      Comment

                      • Lars

                        #26
                        Re: goto, cls, wait commands

                        You sir are a troll for sure. QBasic?! When was the last time you did
                        any programming, 1989? Gave me a laugh though.

                        Lars

                        Comment

                        Working...