Apart from the Bottom-Up declarations already described, Elan
has Top-Down declarations for declaring objects. Every object
in an Elan program has a <#3315#>name<#3315#>, a <#3316#>type<#3316#>, an <#3317#>access attribute<#3317#>
(<#3318#>VAR<#3318#> or <#3319#>CONST<#3319#>) and (during execution) a <#3320#>value<#3320#>,
which may be undefined. There are two forms of <#3321#>object-declaration<#3321#>:
(315,060)<#4622#>
(000,050)<#4414#>object-declaration<#4414#>
93
(000,030)<#4415#>(1,0)<#3323#>030<#3323#><#5006#>#tex2html_wrap6485#(100,010)<#5007#>variable-declaration<#5007#><#5006#>
(1,0)<#3326#>030<#3326#><#4415#>
94
(005,020)<#3327#>(20,20)[rt]<#3327#>
(025,020)<#3328#>(20,20)[lb]<#3328#>
95
(025,010)<#4416#>(1,0)<#3329#>005<#3329#><#5009#>#tex2html_wrap6489#(100,010)<#5010#>constant-declaration<#5010#><#5009#>
(1,0)<#3332#>005<#3332#><#4416#>
96
(135,020)<#3333#>(20,20)[rb]<#3333#>
(155,020)<#3334#>(20,20)[lt]<#3334#>
97
<#4622#>
A <#3335#>variable-declaration<#3335#> declares one or more objects (<#3336#>variables<#3336#>)
with the access attribute <#3337#>VAR<#3337#> of one same type.
(315,090)<#4623#>
(000,080)<#4417#>variable-declaration<#4417#>
98
(000,060)<#4418#>(1,0)<#3339#>030<#3339#><#5012#>#tex2html_wrap6507#(060,010)<#5013#>type-declarer<#5013#><#5012#>
(1,0)<#3342#>030<#3342#> <#5019#>(040,010)<#5022#>VAR<#5022#><#5019#> (040,010)
(1,0)<#3345#>005<#3345#><#4418#>
99
(165,050)<#3346#>(20,20)[r]<#3346#>
100
(275,030)<#3347#>(20,20)[r]<#3347#>
(275,040)<#4419#>(-1,0)<#3348#>060<#3348#><#4419#>
(025,040)<#4420#>(1,0)<#3349#>180<#3349#> <#5028#>(10,010)<#5031#>,<#5031#><#5028#> (10,010) <#4420#>
(025,030)<#3352#>(20,20)[l]<#3352#>
101
(025,020)<#4421#>(1,0)<#3353#>005<#3353#><#5033#>#tex2html_wrap6523#(080,010)<#5034#>variable-name<#5034#><#5033#>
(1,0)<#3356#>030<#3356#> <#5040#>(10,010)<#5043#>::<#5043#><#5040#> (10,010)
(1,0)<#3359#>030<#3359#><#5045#>#tex2html_wrap6533#(060,010)<#5046#>expression<#5046#><#5045#>
(1,0)<#3362#>060<#3362#><#4421#>
102
(115,010)<#3363#>(20,20)[rt]<#3363#>
(135,010)<#3364#>(20,20)[lb]<#3364#>
(135,000)<#4422#>(1,0)<#3365#>110<#3365#><#4422#>
(245,010)<#3366#>(20,20)[rb]<#3366#>
(265,010)<#3367#>(20,20)[lt]<#3367#>
103
<#4623#>
The <#3368#>expression<#3368#> preceded by the curious sign <#3369#>::<#3369#> is the
<#3370#>initialization<#3370#> for the variable.
Its value (or, if there is no initialization, an undefined value)
is assigned to the <#3371#>variable-name<#3371#>.
A <#3372#>constant<#3372#> is an object with the access attribute <#3373#>CONST<#3373#>
and always obtains a well defined value at its declaration.
(315,080)<#4624#>
(000,070)<#4423#>constant-declaration<#4423#>
104
(000,050)<#4424#>(1,0)<#3375#>030<#3375#><#5048#>#tex2html_wrap6559#(060,010)<#5049#>type-declarer<#5049#><#5048#>
(1,0)<#3378#>030<#3378#> <#5055#>(040,010)<#5058#>CONST<#5058#><#5055#> (040,010)
(1,0)<#3381#>005<#3381#><#4424#>
105
(165,040)<#3382#>(20,20)[r]<#3382#>
106
(275,020)<#3383#>(20,20)[r]<#3383#>
(275,030)<#4425#>(-1,0)<#3384#>060<#3384#><#4425#>
(025,030)<#4426#>(1,0)<#3385#>180<#3385#> <#5064#>(10,010)<#5067#>,<#5067#><#5064#> (10,010) <#4426#>
(025,020)<#3388#>(20,20)[l]<#3388#>
107
(025,010)<#4427#>(1,0)<#3389#>005<#3389#><#5069#>#tex2html_wrap6575#(080,010)<#5070#>constant-name<#5070#><#5069#>
(1,0)<#3392#>030<#3392#> <#5076#>(10,010)<#5079#>::<#5079#><#5076#> (10,010)
(1,0)<#3395#>030<#3395#><#5081#>#tex2html_wrap6585#(060,010)<#5082#>expression<#5082#><#5081#>
(1,0)<#3398#>060<#3398#><#4427#>
108
<#4624#>
A variable can obtain another value assignation, whereas a constant
can not be assigned to. If so desired, the access attribute <#3399#>CONST<#3399#>
may be left out, but this is not advised since it leads
to degradation of syntactic error-detection.
An <#3400#>object-declaration<#3400#> may very well occur in a <#3401#>repetition<#3401#>. Each
time the declaration is executed, its initialization is executed
anew.