January 2001
Intermediate to advanced
480 pages
7h 22m
English
As with ordinary variables, integer variables need not be declared. A variable can simply be given an integer value, and then used in an arithmetic expression.
$ X=12 $ ((Y=X * 3)) $ print $Y 36
However, variables can be explicitly declared integer type by using the typeset –i command. The following example sets the DAYS and MONTHS variables to be integer type:
$ typeset —i DAYS MONTHS=12
There is also another command called integer, which is equivalent to typeset –i. It could be used to declare the DAYS and MONTHS variables like this:
$ integer DAYS MONTHS=12
Variables do not have to be explicitly declared integer type to be used in arithmetic expressions. It may improve performance, but what you really gain ...
Read now
Unlock full access