Const parameter - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Const parameter

TheEvanTheEvan Posts: 7Member
The Const parameter is said to be able to prevent modification of the argument value, but i am able to reassign A as seen below perfectly? So what's the difference between a Const parameter and the default parameter? (other than it working as pointer and hence saving memory for large arguments)
[code]procedure Example(Const A: Integer);
begin
A:=5;
end; [/code]

Comments

  • DWDuckDWDuck Posts: 31Member
    U will not be able to change the value of the const variable again...

    Const declaration takes the assigned value of it the first time a value is assigned...

    I've never seen a declaration like urs frankly dont know the need of it, but if you do declare a const variable at outside of the procedure variable inputs you cannot change the value... Frankly im surprised your declaration worked...

    Hey enjoy
    Darkwing Duck aka DWduck signing off :)
Sign In or Register to comment.