Declare a Function in Swift

In this Swift code example we will learn how to declare a function in Swift.

 // Declare a function
func sayHelloWorld() {
    print("Hello World")
}

// Call function
sayHelloWorld()

[raw_html_snippet id=”cookbookpagecoursesheader”]

Unit Testing Swift Mobile App

Apply Test-Driven Development(TDD) process to iOS mobile app development in Swift Preview this video course.