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

new topic     » topic index » view message » categorize

2. Re: Declaring variables in a procedure?

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Declaring variables in a procedure?

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: Declaring variables in a procedure?

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu