Swift Program To Create A Simple Closure Function

You are currently viewing Swift Program To Create A Simple Closure Function

Swift Program To Create A Simple Closure Function

// Swift program to create a 
// simple closure function

import Swift

// Define a closure
var SayHello = {
    print("Hello World")
}

// call the created closure
SayHello()

Output

Hello World

...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