Swift Introduction
Swift is a programming language created for building apps and programs.
A greeting on screen
This short program prints one greeting. The greeting is the whole output.
print("Hello from Swift")Two lines in order
The first print runs before the second print. Each line appears below the one before it.
print("First line")
print("Second line")A number on screen
Print can also show a number by itself. This program shows the number 3.
print(3)Example
print("Welcome")
print("Day")
print(1)Key points
- People use Swift to build apps and programs.
- Swift code in this course runs as plain programs on a computer.
- Use print to put a value on the screen.
In this example, the first print shows Welcome. The second print shows Day below it. The third print shows the number 1 below Day.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Programiz Swift Compiler
Exercise
What is Swift?