• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Functions > Creating a Function

Creating a Function

Creating a function is as easy as using the keyword function, providing a name for the function, followed by a pair of parentheses for parameters (we discuss the topic of parameters in more depth later), then a colon, and the data type of the return value (return values are also discussed later in this chapter). After that, you can place whatever code you want between two curly brackets. It looks something like this:

function myFunction():ReturnType{
    //script to run in function
}


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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