Swift: output and comments

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.

 

Advertisements

One thought on “Swift: output and comments

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: