![]() |
Please expand this article or section. You can help by adding more information if you are an editor. More information might be found in a section of the talk page. (October 2018) |
Swift is a language used to program apps on Apple devices. This tutorial will teach you how to make a Swift program that prints "Hello, world!" to the console.
Differences between most programming languages
In Swift, there are many differences to make it easier to beginners.
- You need no semicolon (;) after each command.
- You do not need to declare variables.
Your first program
To print "Hello, world!", use the following code below:
print("Hello, World!")
Into more detail
The print()
function prints the chosen text to be added to the console. In the brackets ( ( and ) ) is what it's going to print. To print anything you want, Change the text in the quotation marks (".) For example, if you wanted to print "Scratch is made by MIT", just use the following code:
print("Scratch is made by MIT")