Presentation on theme: "Procedures and Functions. What are they? They are both blocks of code that can be reused to perform specific task. However there is a difference: Function-"— Presentation transcript:
Procedures and Functions
What are they? They are both blocks of code that can be reused to perform specific task. However there is a difference: Function- The word comes from mathematics. It calculates a value based on inputs. E.g. Input X Function= Multiply by 2 Output= 2X Procedure- A set of commands that can be executed in a certain order. They do not return values. E.g. run Function1 then run Function2
Languages can help you out Programming languages often contain built in function. These are often complex action that would otherwise take a lot of time to create by yourself. They save time and make it much simpler to code E.g. Python- input(), len(),.upper()
You also need to know about Parameters and Return Values Parameter- information given to a function or procedure (a numerical or other measurable factor forming one of a set that defines a system or sets the conditions of its operation) E.g. Python Return Values – Information that come out of a subroutine. Look it even says return.