After seeing the different types of data that exist in Swift (Swift: Types of variables – constants), we will now learn how to output it.
Basically, in Swift, in order to output the data, we need to use the function “print” and we put the variable name between parentheses!
var name : String = “Batman”
print (name) // this will show Batman as output
Note that when you want to comment something in Swift, we need to put in front of our comment “//”. This is a single line comment. A multiple line comment is a text that goes over multiple lines and is between “/* */”
This is a
multiple line comment */
Now that we know how to output the data and make comments, we will learn how to combine several variables and publish a single output.