return function with parameter swift

func fullName(fName:String,lName:String) -> String {
let myFullName:String = "\(fName) \(lName)"
// print(myFullName)
return myFullName
}

//calling the parameter
let name:String = fullName(fName: "Hi", lName: "Hello")
print(name)


/**************/
return function with parameter:

func add(first:Int, second:Int) -> Int {
return first+second
}
//calling the parameter
var addition = add(first: 10, second: 5)
print(addition)
Previous
Next Post »