You might be wondering when we are supposed to actually start writing some Swift code; it is right now. Let's go straight to the code by typing the following code in the editor of our playground:
print("Hello World")
Tip
All related source code for this chapter can be found here: https://github.com/swift-book-projects/swift-3-programming-for-kids/tree/master/Chapter-3
After writing this code in the editor, the playground should run. You can see this by checking whether the play button at the bottom changes to a stop button, or whether the status at the top shows Running instead of Ready. When the playground is done running, you should be able to see the result of our code in the right column. It should be as shown:
"Hello World\n"
Don't worry about \n
being added to your print statement; it is simply Xcode adding it for our convenience. This sequence of characters ( \n
) will be translated into a new line when our application runs. This means that, if we add multiple print...