-
Book Overview & Buying
-
Table Of Contents
Mastering Swift 5.3 - Sixth Edition
By :
All good computer books that are written to teach a computer language have a section that shows the user how to write a Hello World application. This book is no exception. In this section, we will show you how to write two different Hello World applications.
Our first Hello World application will be a traditional Hello World application that simply prints Hello World to the console. Let's begin by creating a new playground and naming it Chapter_1_Hello_World.
In Swift, to print a message to the console, we use the print() function. In its most basic form, we would use the print() function to print out a single message, as shown in the following code:
print("Hello World")
Usually, when we use the print() function, we want to print more than just static text. We can include the value of variables and/or constants by using string interpolation or by separating the values within the print() function with commas. String interpolation uses a special...