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> Functions$INCREMENTAdds a specified increment to the existing value of a local or global variable.$INCREMENT(variable,num)$I(variable,num)ParametersvariablenumThe variable whose value is to be incremented. It can specify a localvariable, a process private global, or a global variable and can be eithersubscripted or unsubscripted. The variable need not be defined. If thevariable is not defined, or is set to the null string (""), $INCREMENTtreats it as having an initial value of zero and increments accordingly.Only variables may be specified; a literal value cannot be specifiedhere.Optional — The numeric increment you want to add to variable. Thevalue can be a number (integer or decimal, positive or negative), astring containing a number, or any expression which evaluates to anumber. Leading and trailing blanks and multiple signs are evaluated.A string is evaluated until the first nonnumeric character is encountered.The null string ("") is evaluated as zero.If you do not specify num for the second argument, <strong>Caché</strong> defaults toincrementing variable by 1.Description$INCREMENT resets the value of a variable by adding a specified increment to the existingvalue of the variable and returning the incremented value. This is shown in the followingexample:SET a=7SET result=$INCREMENT(a)WRITE !,result /* result is 8 (a+1) */WRITE !,a /* variable a is also now 8 */The variable parameter can be a local variable, a process private global, or a global variable.It can be subscripted or unsubscripted. It cannot be a literal. If this variable is not defined, orset to a null string, it is treated as having a value of zero.220 <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!