1. Declaring variables in a procedure?
- Posted by dstanger at belco.bc.ca Aug 19, 2001
- 397 views
Good Morning, I am trying to declare variables inside a procedure like so: procedure whatever() integer x, y, z x = 1 y = 2 z = 3 sequence other_stuff other_stuff = {} ....bunch of code.... end procedure If I only try to declare one type in the procedure, such as just integer, it works fine, but if I try to declare more than one I get an error. The reference manual doesn't say anything that I can see regarding declaring inside procedures only that there is "a fixed number of named parameters" but I took that to mean that there is a limit to how many parameters can be passed to a procudure. Any one have any enlightenment for me? thank you, DAvid S.
2. Re: Declaring variables in a procedure?
- Posted by Kat <gertie at PELL.NET> Aug 19, 2001
- 384 views
On 19 Aug 2001, at 10:40, dstanger at belco.bc.ca wrote: > > > Good Morning, > > I am trying to declare variables inside a procedure like so: > > procedure whatever() > > integer x, y, z > x = 1 > y = 2 > z = 3 > > sequence other_stuff > other_stuff = {} > > ....bunch of code.... > > end procedure > > If I only try to declare one type in the procedure, such as just integer, it > works fine, but if I try to declare more than one I get an error. How are you declaring the others? This should work fine: procedure whatever() integer x, y, z sequence a, b, c atom p x = 1 y = 2 z = 3 p = 0 a = "" b= {} c="abc" end procedure Kat
3. Re: Declaring variables in a procedure?
- Posted by Irv Mullins <irvm at ellijay.com> Aug 19, 2001
- 379 views
On Sunday 19 August 2001 13:40, dstanger at belco.bc.ca wrote: > > Good Morning, > > I am trying to declare variables inside a procedure like so: > > procedure whatever() > > integer x, y, z > x = 1 > y = 2 > z = 3 > > sequence other_stuff > other_stuff = {} > > ....bunch of code.... > > end procedure Just make all the declarations before you execute any code: procedure foo() integer x,y,z sequence stuff x = 1 y = 2 z = 3 s = "Stuff" ..... end procedure Regards, Irv
4. Re: Declaring variables in a procedure?
- Posted by Jason Mirwald <mirwalds at sbcglobal.net> Aug 19, 2001
- 393 views
If you define a variable inside a function/procedure, then try to declare another variable, it will give you an error. Try something like this instead, making all the variable declarations first, then defining them afterward; integer x, y, z sequence other_stuff x = 1 y = 2 z = 3 other_stuff = {} ----- Original Message ----- From: <dstanger at belco.bc.ca> To: EUforum <EUforum at topica.com> Sent: Sunday, August 19, 2001 10:40 AM Subject: Declaring variables in a procedure? > > Good Morning, > > I am trying to declare variables inside a procedure like so: > > procedure whatever() > > integer x, y, z > x = 1 > y = 2 > z = 3 > > sequence other_stuff > other_stuff = {} > > ....bunch of code.... > > end procedure > > If I only try to declare one type in the procedure, such as just integer, it > works fine, but if I try to declare more than one I get an error. The > reference manual doesn't say anything that I can see regarding declaring > inside procedures only that there is "a fixed number of named parameters" > but I took that to mean that there is a limit to how many parameters can be > passed to a procudure. > > Any one have any enlightenment for me? > > thank you, > DAvid S. > > > > >