View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Could somonew explain this script’s behavior?

sakenjm wrote on May 31, 2007

Hi,

I don't understand what is wrong here. Here's a simple script:

procedure foo(aa)
string aa="Testing" {prompt = "Does this work "}
print ("var= ",aa)
begin
string laa=""
laa=aa
print ("lvar=",laa)
end

Here's what happens when I run it:

cl> task $foo=foo.cl
cl> foo
lvar=
cl> logout

And when I try it slightly differently:

cl> task foo=foo.cl
cl> foo
**: print ("var= ",aa)
^
ERROR: syntax error, line 3

I would greatly appreciate it if someone could explain what I'm doing wrong here.

Thanks.

jon

Mike Fitzpatrick wrote on May 31, 2007

Declaring a task as e.g. "$foo" has the '$' tell the CL the task has no parameters and so the 'aa' param isn't seen. Where I'm confused is why the print() statement didn't trigger a sytax error in both cases -- the only thing allowed between the 'procedure' and 'begin' statement should be variable/parameter declarations.

-Mike

Last post on May 31, 2007