Answers for "swift print"

1

swift print

print("Hello World")
//printing a value
let num = 5
print(num)
print("a num: " + num) //concatenation
print("a num: \(num)") //interpolation
Posted by: Guest on June-30-2020
1

print string sqift

var str1 = "Hello, world"
print(str1)
Posted by: Guest on February-11-2020
1

print things in swift

print("Hello World")
print("Hello Again") 
//prints Hello World, and then Hello Again on a new line
//Hello World
//Hello Again
print("Hello World", terminator="")
print("Hello Again")
//prints Hello World and then Hello Again on the same line
//Hello WorldHello Again
print(123.45)
//prints 123.45
var message: String = "Hello"
print(message)
//prints Hello
Posted by: Guest on July-14-2020
0

printf in swift

let x = 3.1415926
print(String(format: "%.2f", x)) //3.14

print(String(format: "%2.2f", x)) //  3.14 (two blank spaces in front of 3.
Posted by: Guest on November-25-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language