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.
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.