Functions

Create function

func FunctionName()
{
 //do the things inside function
}

Create function
FunctionName()


Parameters in functions
func FunctionName(msg: String, num: Int)

Calling it:
FunctionName(msg: "Wow", num: 5)

Return values in functions:

func FunctionName() -> String
{
 return "Hello"
}



Comments

Popular posts from this blog

Setting up a playground

Go to another page