Information Technology Reference
In-Depth Information
before, so you have a good idea what they stand for. In summery, the first can be just
about anything, any letter of the alphabet, a number or special character.
integer
is any single digit, positive number, including zero.
decimal
allows us to talk about the numbers between whole numbers, such as 3.23 , and
signed
expands our system so that we have negative as well as positive numbers.
The line handling our balance needs some explanation and it ends in
( balance, mask ($$$$,$$9.99)).
This will give us the account balance in a way that we'd like to view it. The keyword
mask
is used to reformat the balance so that it will have the appropriate dollar sign, commas if
the amount is a thousand dollars or more as well as the decimal point in all cases. The
dollar sign used the way it is here allows it to float to just left of the significant digit in
the amount. Recall that the record has
00001620
for the balance, so with the mask, the leading zeroes on the left are not printed and the
dollar sign winds up just to the left of 16.20. The
9
in the mask forces the number to print, even if it is a zero. Hence a balance of a quarter
would print as
$0.25
using this mask. The decimal amount will always print with this mask. Note also that we
need two right parentheses to end the statement in order to balance those two parentheses
on the left and the mask is enclosed within one set of parentheses. The outer parentheses
are needed to assure that the mask goes with the variable,
balance .
Using this same mask, an amount of three thousand dollars and ten cents would
print as $3,000.10. We could choose to not print the dollar sign or leave out the comma
and this we could do with a change to the mask, using
mask (999999.99).
Our values would then be
000016.20
and
003000.10
respectively. To suppress the leading zeroes we could change it to
mask (zzzzzz.99)
and now we would get
16.20
and
3000.10
for our formatted amounts. The character z here just suppresses the leading zeroes.
Search WWH ::




Custom Search