1. Procedure vs Function
- Posted by isaacbh May 14, 2016
- 1323 views
Hi, a newbie here. I've read in the docs that the return value of a function can be ignored. So, what's the real difference between a procedure and a function? I mean, I can just use functions exclusively and put a return 1 statement at the end of functions that act as procedures. Is this the case?
2. Re: Procedure vs Function
- Posted by SDPringle May 14, 2016
- 1309 views
That is right. You can call functions as though they were procedures. Since 4.0.0...
3. Re: Procedure vs Function
- Posted by ghaberek (admin) May 14, 2016
- 1304 views
Hi, a newbie here. I've read in the docs that the return value of a function can be ignored. So, what's the real difference between a procedure and a function?
The difference is that a function must return a value and a procedure cannot return a value.
I mean, I can just use functions exclusively and put a return 1 statement at the end of functions that act as procedures. Is this the case?
You could, certainly, but others would regard it as poor programming practice.
Try to avoid the law of the instrument: learn to use each tool, and use each tool for its intended purpose.
-Greg