Announcement

Collapse
No announcement yet.

Here we go again...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    Maybe 'duplicate' variable names don't work for me because I always use #DIM ALL.

    Regardless, I don't think I've ever even been tempted to use B% (scalar) and B%() (array) in the same procedure.

    Code:
    #SILLY OFF   ' Save me from myself!

    Leave a comment:


  • Hanns Ackermann
    replied
    Russ, Michael,

    many thanks for your kind response. Indeed, it was not my intention to get gray hairs
    while coding as I did in my example, it was just to learn somewhat more about the logic
    of the compiler. Nevertheless, following your advice, I'll keep hands off things like this
    and stick to #dim all as I usually used to do.

    BTW, in my example prog the B% and B%() thing works well - AISIMVHO The same is
    with B%(B%), B(B%) and B%(B) etc. - I agree, Michael, may be that's really silly, just
    a question out of curiosity ...

    Regards, Hanns.

    Leave a comment:


  • Michael Mattias
    replied
    >and B%() and B%

    This I know does not work: a scalar variable name may not conflict with an array variable name.

    "Work" or "Not Work" aside, coding like this is IMNSHO totally silly. As long as you have to port it, clean it up while you are at it.

    Leave a comment:


  • Russ Srole
    replied
    Hanns,

    When I first started using PBWin, someone suggested Dim All and at first I thought it was a big pain, but stuck with it, just to see. The advice was good, it's a good way to head off certain kinds of bugs (typos) at the pass.

    Leave a comment:


  • Hanns Ackermann
    started a topic Here we go again...

    Here we go again...

    Just curious: Is there a problem with using A and A% in the first and B%()
    and B% in the second part of my example, respectively? I know, DIM ALL will
    be the best choice, but I'm just porting an old DOS program to 8.04 and it
    would be very easy for me to proceed as I did in my example program below.

    ADDED: my example program works as intended, all results are ok

    Thanks and Regards!
    Hanns

    Code:
    #COMPILE EXE
    DEFSNG A-B  ' <-- cave!!
    FUNCTION PBMAIN () AS LONG
      A=1
      A%=2
      MSGBOX STR$(A)+STR$(A%)
      DIM B%(1:1)
      B%(1)=3
      B%=4
      MSGBOX STR$(B%(1))+STR$(B%)
    END FUNCTION
    Last edited by Hanns Ackermann; 14 Nov 2007, 03:12 PM.
Working...
X