Welcome to iraf.net Thursday, May 02 2024 @ 12:08 AM GMT


 Forum Index > Help Desk > Applications New Topic Post Reply
 Strange behaviour in procedure script?
   
Gaba_p
 03/11/2009 05:27PM (Read 2024 times)  
++++-
Regular Member

Status: offline


Registered: 10/10/2008
Posts: 104
Hi,
I'm writing a procedure script that looks like this:procedure test1 (query parameters)#declaration of parameters
real fwhm {prompt = "Ingrese el valor de FWHM"}begin #declaration of variables
string variable1#if structure
if (xxxxx) {
xxxx
xxx
}
else {
xxx
}etc... (more script commands)end
The thing is that when I run this script, it FIRST runs the 'if structure' and THEN it asks for the 'query parameters' (defined before 'begin').
Am I doing something wrong? Is this the way it should work?
In any case I want it to do this (I'm happy with the way the script runs), I just don't know if this is a sign that something is not working properly (in that case I'd rather fix it now that the script is small) or just normal behaviour.Thanks!

 
Profile Email Website
 Quote
fitz
 03/11/2009 05:27PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
The query is made when the parameter is first accessed in the script, if this is after your 'if' statement then that would explain it. A common practice is to first get all the parameters at the top of your script and save them to local variables, this will avoid the query each time the parameter is accessed (i.e. a query parameter in a loop may prompt each time).-Mike

 
Profile Email
 Quote
Gaba_p
 03/11/2009 05:27PM  
++++-
Regular Member

Status: offline


Registered: 10/10/2008
Posts: 104
Thanks Mike, now I get why it's doing this.Since the 'if structure' is a control (a "check point"), I want it to appear before the query parameters (if this check is 'no', the script must exit).

 
Profile Email Website
 Quote
   
Content generated in: 0.10 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login