Print in Swift 3

Viewed 29952

i would like to know what's the different between these two way to print the object in Swift. The result seems identical.

var myName : String = "yohoo" 
print ("My name is \(myName).")

print ("My name is ", myName, ".")
3 Answers

No difference between the two

var favoriteFood: String = "Pizza" //favoriteFood = Pizza

//both print the same thing
print("My favorite food is", favoriteFood)
print("My favorite food is \(favoriteFood)")
Related