11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

NEWSubroutines with Parameter PassingIf you call a subroutine with parameter passing, <strong>Caché</strong> issues an implicit NEW commandfor each of the variables named in the subroutine's formal parameter list. It then assigns thevalues passed in the DO command's actual parameter list (by value or by reference) to thesevariables.If the DO command uses parameter passing by value and if the formal list names any existinglocal variables, <strong>Caché</strong> places the existing variables and their values on the stack. When thesubroutine terminates (with either an explicit or an implicit QUIT), <strong>Caché</strong> issues an implicitKILL command for each of the formal list variables to restore them from the stack.When using NEW command within a subroutine, never specify any of the variables namedin the subroutine's formal parameter list. By defining these variables as NEW, you renderthem undefined and make their passed values inaccessible.See Also• DO command• QUIT command• SET command• $ETRAP special variable<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!