Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error C025 - must vars be declared before other commands?

Status
Not open for further replies.

KittyZoso

Programmer
Jun 7, 2004
1
US
According to Aspect Script User's Guide November, 1999, Variables: The Basics

Variables are normally defined at the beginning of a procedure or function, although a variable
definition can occur almost anywhere within an ASPECT script.

It appears this is not the case for me! Everytime I try to put a STRING declaration after any "command", even one that doesn't reference the variable in question, I get C025 Unexpected Command error. For example, the following compiles without error:

proc main
STRING junk
locate 2 0
termwrites "First message`n"
junk = "this is garbage"
termwrites junk
endproc

Whereas this gives errors:

proc main
locate 2 0
termwrites "First message`n"
STRING junk
junk = "this is garbage"
termwrites junk
endproc

JUNK.WAS:
Error C025 Line 4: Unexpected command: STRING
Error C024 Line 5: Invalid command or expression token: JUNK
Error C023 Line 6: Invalid expression token: JUNK
Error C162 Line 6: Invalid string

Note I'm quoting the pdf manual that came with version 4.8 and am actually working on version 3.0 installed on a WFW 3.11 machine. This machine has legacy scripts written for and still used with Procomm Plus 2.0, which will hopefully be made obsolete soon.

For now, I'm just declaring all the variables first, but was just curious and also thought this might help other newbies like myself.
 
To the best of my knowledge, the text you quoted is incorrect and any variables must be declared at the beginning of a script, procedure, function, etc.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top