Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Tutorials listed in this section have not been reviewed nor are affliated by Code Forum. It is the sole responsbility of the authour to properly maintain and ensure information is accurate.

What is a Function?

What is a function?​

A function... what is a function? A function is a group or set of instructions that can be called anytime. A function is a great way to reuse code without actually writing it over and over again.

Disclaimer: the syntax below does not belong to any particular language, depending on the language it may be slightly different.

Example:​

Making eggs:
  1. Cracking an egg into a pan.
  2. Flip egg.
  3. Place on a plate.

Syntax:​

Code:
function makeEggs() {
    add egg to pan
    flip egg
    place egg on plate
}

With this function, we can call by using makeEggs(); within our code and it will execute the code within the makeEggs function. Once code has been successfully been executed it will return after where the function was called.
 
Back
Top Bottom