Const parameter - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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);
end; [/code]


  • 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.