• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Functions

Functions are an important part of programming. The basic idea behind a function is to create one when you have repetitive blocks of code. For instance, if you are constantly getting the area of a rectangle, that is a perfect opportunity for a function.

You create a function with the keyword function and then the name of the function followed by an opening parenthesis, which will hold any parameters you may want to put in the function, followed by a closing parenthesis. Then an opening curly bracket ({), after that, any code that you want to run, and then a return statement to send information back out of the function, followed, finally, by a closing curly bracket (}) on its own line.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint