Hi
Just looking at http://www.ladyada.net/learn/arduino/lesson4.html
I wondered whether a procedure is a function and why procedure is the language used in the lessons?
Is there a big reason or would the two be considered interchangeable?
Thanks
function or procedure
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: function or procedure
In practice, these terms are often used interchangeably, along with 'method', 'subroutine', 'subprogram' etc.
In some programming languages functions and procedures have different syntax and semantics. But C/C++ is not so picky.
Mathematically speaking, a function returns a value based on the input. It should have no side effects.
A procedure is a series of operations. It may or may not return a value and/or have side-effects.
In some programming languages functions and procedures have different syntax and semantics. But C/C++ is not so picky.
Mathematically speaking, a function returns a value based on the input. It should have no side effects.
A procedure is a series of operations. It may or may not return a value and/or have side-effects.
-
- Posts: 2
- Joined: Tue May 20, 2014 5:48 am
Re: function or procedure
I agree with what you say.
I would probably use the term function in the examples. It seems more appropriate to me.
Thanks
I would probably use the term function in the examples. It seems more appropriate to me.
Thanks
Please be positive and constructive with your questions and comments.