Re: scope of variables

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

FWIW, I'm against all this willy-nilly declaration of variables anywhere; if you feel the need to declare more variables half way down a routine it is probably a sign that your routine is getting too big. That aside, I just thought of this idiom:

procedure P(...,boolean preserve) 
 
    if preserve then 
       object wasX = X 
    end if 
    ... 
    if preserve then 
       X = wasX 
    end if 
end procedure 

While I don't much care whether that is right, wrong, or whatever, someone here might want to consider it.

Regards,
Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu