Solved

qow 10: What does var, const, ... declarations in proc/function-Parameters?

Posted on 2002-03-11
6
196 Views
Last Modified: 2010-04-05
hi experts,

i am starting a new quest: qow = question of the week :-)
each week i will introduce a new simple? question.

now qow 10

the first working solution will get the points (a graded).

sorry, top 15 experts, you are not allowed to solve this
q, only other can solve this question :-(

well the question is:
What does var, const, ... declarations in proc/function-Parameters, what is the effect?

an explaination is needed

let see

meikl ;-)
0
Comment
Question by:kretzschmar
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:craig_capel
ID: 6855875
You are either bored, or have nothing to do with your points :P

0
 
LVL 27

Author Comment

by:kretzschmar
ID: 6855890
>or have nothing to do with your points :-)

yep, but thats not an answer for my q :-P
0
 
LVL 6

Expert Comment

by:zebada
ID: 6855932
Sheesh I'm bored too :)

var = pass by reference
procedure/function gets a reference to the caller's value rather than a copy. This means the procedure/function can modify the caller's value.

const = constant
procedure/function cannot modify the value that is passed to it. This also means that you cannot pass the const parameter as a var parameter to another procedure/function.


0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 27

Author Comment

by:kretzschmar
ID: 6855943
well, looks good, zebada

don't be bored, its just a quest.

any other declarations possible?
what the bahavaiourm if no one (var, const,..) is given?

meikl ;-)
0
 
LVL 6

Accepted Solution

by:
zebada earned 25 total points
ID: 6855972
parameter with no modifiers is passed by value.
The called function/procedure is free to modify the copy that is passed to it but it will have no effect on the value as seen by the caller.

Another option is "out".
Similar to "var" but is only used to return a value not to pass in a value.

0
 
LVL 27

Author Comment

by:kretzschmar
ID: 6855980
well, zebada,
just complete and correct :-)

thanks for participating on this quest.

next week a new ?simple question

meikl ;-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Form ownership 4 115
oracle global variables 4 76
Unique identifier on a terminal server (rdp) 4 67
Tidtcpserver listening on multiports? 1 35
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question