|
-
May 24th, 2001, 12:14 AM
#1
Function or Procedure
What are the factors to be considered to write a method as Procedure or function?
-
May 24th, 2001, 12:19 AM
#2
Re: Function or Procedure
function has return value.
so if U want to return a value after the process u can use a function
Dinesh Asanka
-
May 24th, 2001, 12:23 AM
#3
Re: Function or Procedure
Yes, of course, Function has return value. but i can return this value as out parameter through a procedure also.
-
May 24th, 2001, 12:30 AM
#4
Re: Function or Procedure
if UR using procedure
call ProcedureName(parameters)
if returnvalue = true then
endif
if UR using Function
if FunctionName(parameters) = true then
endif
Dinesh Asanka
-
May 24th, 2001, 12:34 AM
#5
Re: Function or Procedure
Thanks..
This infers that
It is most appropriate to use a function when the return value is used in expressions, as procedures cannot be used in expressions
-
May 24th, 2001, 07:20 AM
#6
Re: Function or Procedure
...and it is not a good practice to use variable (public or global) to the purpouse of return a value from a sub: you will be in a mess while trying to keep track of all public/global variables as soon as your project grows; moreover, public/global may be used by mistake somewhere else, where they should not...
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|