NNikN
NNikN

Reputation: 3850

Println in Swift with method having String Parameters

func greetingMessage(name:String,message:String)->String{
    return "Greeting message  is \(message) for name\(name)"
}

The above code prints the message : "This was the message => , Greeting message is Hello for nameJohn"

  println("This was the message => ",greetingMessage("John", message: "Hello"))

The problem here is the "," character. How do I modify this so that it doesn't appear in the output ?

Thanks.

Upvotes: 2

Views: 3795

Answers (2)

fqdn
fqdn

Reputation: 2843

func greetingMessage(name: String, message: String) -> String {
    return "Greeting message is \(message) for name \(name)"
}

println("This was the message => " + greetingMessage("John", "Hello"))

Upvotes: 1

Ricky
Ricky

Reputation: 10505

Try

  println("This was the message => " + greetingMessage("John", message: "Hello"))

Upvotes: 2

Related Questions