Announcement

Collapse
No announcement yet.

Trouble with previously working function

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

  • Paul D. Elliott
    replied
    Steve,

    When you converted the subroutine, did you put "SUB" in front of the
    name? They want
    Code:
    SUB subroutine
    ' code
    END SUB
    At least that's what it looks like from what you have posted.

    Leave a comment:


  • Knuth Konrad
    replied
    Originally posted by Steve Andrues View Post
    Now when I try and compile I get an error message "Variable Expected" on one of the fubction declarations.
    I'm pretty sure that if you poste the actual declaration, this forum will sort out the problem in no time, but as my crystal ball is due for maintenance right now, at least I have a hard time to make an educated guess.

    Leave a comment:


  • StanHelton
    replied
    When I port old QB code the most common problem I run into is variable scoping issues. In GOSUB/RETURN blocks all variables maintain their scope during the SubRoutine -- default to global.

    In SUB/END SUB blocks all variables default to LOCAL -- not visible outside the SUB. A variable inside the SUB with the same name as a variable outside the SUB is a different variable.

    And I will repeat John's point with this undeniable truth: PBDOS is a richer programming language than QB so check those reserved words.

    Of course, it you could post the actual code of both versions, I'm sure there is someone here who would be happy to guide you.

    Stan


    (If you see this MCM: yes, I have been converted. )

    Leave a comment:


  • John Gleason
    replied
    From the docs:
    Variable expected - A variable was expected, but not found. A common cause for this error is the use of a reserved keyword as a variable.
    Is it possible you've used a reserved keyword as a variable?

    Leave a comment:


  • Steve Andrues
    started a topic Trouble with previously working function

    Trouble with previously working function

    Hi All!
    I am trying to revive a chunk of code that was working before I started "streamlining" it. The trouble started when I converted Quickbasic subroutines

    Subroutine:
    blah, blah
    RETURN

    to PowerBasic subroutines

    Subroutine
    More blah
    End SUB

    Now when I try and compile I get an error message "Variable Expected" on one of the fubction declarations. I confirmed that all of the subs had end sub at the end of each. The function was working previously. Does anyone have any ideas where to go next?

    Thanks,

    Steve
Working...
X