Re: add_item question
- Posted by jimcbrown (admin) Sep 25, 2012
- 1465 views
DOH! Yep, obvious!
OK, so what I learned is that a FUNCTION in Euphoria can be called like a PROCEDURE (not located to the right of an '=' character) without generating an error. Is that in the documentation ?
In Euphoria,
A procedure DOES NOT RETURN a result
A function DOES RETURN a result
Therefore
If you are calling a function you MUST MUST MUST "catch" the result in a pre-defined variable of the type of the expected result.
That is what everybody is trying to tell you.
No, you do not need to "catch" the result anymore, as CK stated.
In general, true. In the specific case of add_item(), you still do. Calling add_item() but not using the return value is pointless, as add_item() has no side effects.
My question is, is there really any need for
procedure
any more? Other than saving on typing, no need for
return 0
?
Well, no not really. Getting rid of it would break a lot of code though.