krishnaroopa
May 24th, 2001, 12:14 AM
What are the factors to be considered to write a method as Procedure or function?
|
Click to See Complete Forum and Search --> : Function or Procedure krishnaroopa May 24th, 2001, 12:14 AM What are the factors to be considered to write a method as Procedure or function? dineshasanka May 24th, 2001, 12:19 AM function has return value. so if U want to return a value after the process u can use a function Dinesh Asanka krishnaroopa May 24th, 2001, 12:23 AM Yes, of course, Function has return value. but i can return this value as out parameter through a procedure also. dineshasanka May 24th, 2001, 12:30 AM if UR using procedure call ProcedureName(parameters) if returnvalue = true then endif if UR using Function if FunctionName(parameters) = true then endif Dinesh Asanka krishnaroopa May 24th, 2001, 12:34 AM 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 Cimperiali May 24th, 2001, 07:20 AM ...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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |