Loading ...
Sorry, an error occurred while loading the content.

Re: [libertybasic] QBasic SWAP command

Expand Messages
  • William E. Lopez
    I follow your reasoning, Stefan, but what if a$ is not larger than b$ and you don t want to swap them? Your code swaps them no matter which is true. Of
    Message 1 of 7 , Sep 5, 2006
    • 0 Attachment
      I follow your reasoning, Stefan, but what if a$ is not larger than b$ and you don't want to swap them? Your code swaps them no matter which is true. Of course, that is exactly what you would want to check multiple flags or something, but I am usually thinking of sorting when I use a swap routine. Thankfully, LB has a native SORT() function, which is considerably faster than I am capable of writing! LOL!

      Thanks again!


      [Non-text portions of this message have been removed]
    • pendl2megabit
      Message 2 of 7 , Sep 5, 2006
      • 0 Attachment
        >
        > I follow your reasoning, Stefan, but what if a$ is not larger
        > than b$ and you don't want to swap them? Your code swaps
        > them no matter which is true. Of course, that is exactly
        > what you would want to check multiple flags or something, but
        > I am usually thinking of sorting when I use a swap routine.
        > Thankfully, LB has a native SORT() function, which is
        > considerably faster than I am capable of writing! LOL!
        >
        > Thanks again!
        >

        Bill,
        the QBASIC SWAP command doesn't check anything, it just exchanges
        the two values.

        ---
        Stefan Pendl



        ___________________________________________________________
        Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
      • William E. Lopez
        Ahh, I remember that now. The SWAP command is always preceded by a comparison if sorting is to be done. Occasionally I can be both dense and slow! LOL!
        Message 3 of 7 , Sep 5, 2006
        • 0 Attachment
          Ahh, I remember that now. The SWAP command is always preceded by a comparison if sorting is to be done. Occasionally I can be both dense and slow! LOL!

          Thanks!


          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.