a little confused about scope

new topic     » topic index » view thread      » older message » newer message

Hi all,

I was having trouble figuring out why I get an error in my program if I 
declare a variable in the middle of a procedure as opposed to declaring 
it at the top of the procedure. If I declare it at the top of the 
procedure, my program runs fine.

This generates the error message: "expected to see possibly 'end', not a 
type"

But if I put the declaration at the top of the procedure it runs fine. 
Do private variables in functions have to be declared before anything 
else? I read the manual under scope, but I didn't come across any 
hardfast rules, am I missing something?

procedure test_block_1()


    
position (20,1)
puts(1,"RAW INPUT:")
print (1,raw_data)
position(22,1)
print(1,process_one)

position(23,1)
puts (1,"LENGTH OF COMMONWORDS SEQUENCE: ")
print(1,length(common_100))

position(27,1)
puts(1,"LENGTH OF TOKENIZED DATA: ")
print(1,length(process_one))

object x  <<<<<<<<<<<<<<<<<OFFENDING LINE<<<<<<<<<<

position(28,1)
x=find("in",common_100)
puts(1,"WHICH PLACE IN COMMONWORDS SEQUENCE: ")
print(1,x)

position(29,1)
print(1,process_two)

position(30,1)
puts(1,"WHICH PLACE IN FIRSTWORDS SEQUENCE: ")
print(1,process_three)
end procedure

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu