Coding for All
Intro to Swift

Intro to Swift

Beginner About Swift →

let vs var, string interpolation, ranges and functions. 25 bite-size lessons.

0 / 25 lessons complete
Start Lesson 1
1
Hello, World!
Make the computer say hello, every programmer's first program.
2
Constants with let
Store a value that never changes.
3
Variables with var
Use var for values that change.
4
The Division Surprise
Try the maths operators and meet integer division.
5
Joining Strings
Glue two pieces of text together with +.
6
String Interpolation
Drop variables straight into text, the Swift way.
7
Booleans
Create a true/false value.
8
If Statements
Only run code when a condition is true.
9
Else
Do one thing when true, another when false.
10
Else If
Check several conditions, one after another.
11
The OR Operator
Combine conditions with ||.
12
The AND Operator
Combine conditions with &&.
13
Arrays
Store several values in one variable.
14
Indexes and count
Pick single items out of an array.
15
Growing Arrays
Add to an array with append.
16
For-in Loops
Visit every item in an array, one by one.
17
Ranges
Count with Swift's neat range syntax.
18
Adding It Up
Total up all the numbers in an array.
19
While Loops
Count down to lift-off with while.
20
Break
Escape from a loop with break.
21
Continue
Skip one trip around a loop with continue.
22
Functions
Write your own function and call it twice.
23
Argument Labels
Give a function information using Swift's readable labels.
24
Return Values
Get an answer back from a function.
25
Roll a Six
Grand finale: keep rolling a dice until you get a 6.