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.

<strong>Caché</strong> <strong>ObjectScript</strong> CommandsWhen the loop terminates, variable contains a value that reflects the increment resulting fromthe last execution of the loop. However, variable is never incremented beyond the maximumvalue specified in end.ArgumentsvariableA variable that holds the current count for the FOR loop. It is a local variable name whichholds the numeric value specified by the other arguments of the FOR command.exprThe numeric value <strong>Caché</strong> assigns to variable before executing the loop commands. The valueof expr can be specified as a literal or any valid expression; <strong>Caché</strong> evaluates expr for itsnumeric value.startThe numeric value <strong>Caché</strong> assigns to variable on the first iteration of the FOR loop. The valueof start can be specified as a literal or any valid expression; <strong>Caché</strong> evaluates start for itsnumeric value.incrementThe numeric value <strong>Caché</strong> uses to increment variable after each iteration of the FOR loop. Itis required if you specify start. The value of increment can be specified as a literal or anyvalid expression; <strong>Caché</strong> evaluates increment for its numeric value. increment can be an integeror a fractional number; it can be a positive number (to increment) or a negative number (todecrement).endThe numeric value <strong>Caché</strong> uses to terminate a FOR loop. When variable equals this value,the FOR loop is executed one last time and then terminated. The value of end can be specifiedas a literal or any valid expression; <strong>Caché</strong> evaluates end for its numeric value.ExamplesArgumentless FORIn the following example, demonstrating argumentless FOR, the user is prompted repeatedlyfor a number that is then passed to the Calc subroutine by the DO command. The FOR loopterminates when the user enters a null string (presses ENTER without inputting a number),which causes the QUIT command to execute.40 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!