1. Procedure vs Function

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?

new topic     » topic index » view message » categorize

2. Re: Procedure vs Function

That is right. You can call functions as though they were procedures. Since 4.0.0...

new topic     » goto parent     » topic index » view message » categorize

3. Re: Procedure vs Function

isaacbh said...

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.

isaacbh said...

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu