Swift Program To Implement Function Overloading Based On Argument Label

You are currently viewing Swift Program To Implement Function Overloading Based On Argument Label

Swift Program To Implement Function Overloading Based On Argument Label

// Swift program to implement function overloading 
// based on argument label

import Swift

func printNum(n1:Int){
    print("@@@Function [email protected]@@")
    print(n1)
}

func printNum(n2:Int){
    print("###Function called###")
    print(n2)
}

printNum(n1:10)
printNum(n2:20)

Output

@@@Function [email protected]@@
10
###Function called###
20

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