Const is fixed value, examples : 1 ,A, Tanjungkona etc. we can use one names to represent a const.
view example program :
begin
. . .
. . .
totdiscount:=tot*0.30;
totdiscountplus:=tot*0.35;
snipped program above, we can write like is:
const
discount =0.30;
discountplus=0.35;
begin
. . .
. . .
totdiscount:=tot*discount;
totdiscountplus := tot*discountplus;
why we use const :
- programs easier to read
- to avoid wrong typing
- we can use a single const repetitive, so if there any change in const, we just change it in declarations.
No comments:
Post a Comment