Swift Program To Create A Nested Function

You are currently viewing Swift Program To Create A Nested Function

Swift Program To Create A Nested Function

// Swift program to create a nested function

import Swift

func sayHello() {
    print("Hello guys")

    func sayHi() {
        print("Hi guys")
    }

    sayHi()
}

sayHello()

Output

Hello guys
Hi guys

...Program finished with exit code 0
Press ENTER to exit console.

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply