Swift · Lesson 1 · On the house

Hello, Swift

print and a tiny first program. Lesson 1 is free — on the house.

Lessons · Swift · Lesson 1 of 10 · On the house

Hello, Swift

print and a tiny first program.

Illustration for the Swift course
Lesson 1 is on the house. The rest opens with the paper, the Daily, or a gift.

This is Swift · introductory, lesson 1: Hello, Swift. Read the teaching and the stills before the checks. The quizzes are open book and test the subject — Swift itself — not product rules or layout trivia.

Swift is Apple's modern language for apps and scripts. You can run small programs with the swift tool or build them with Swift Package Manager / Xcode.

print writes values to standard output and adds a newline by default. Parentheses are required for the call.

A one-file starter needs no main wrapper in a simple script — top-level code runs. In an app or executable target, entry is still clear: the first statements you intend to run.

Swift is case-sensitive. Print is not print. Smart quotes from a word processor will break string literals — use straight ASCII quotes.

Misses: forgetting parentheses on print, typing println (that is not Swift's name), or pasting curly quotes. Fix one thing. Rerun.

Put Hello, Swift in a sentence you could teach a friend: what changes, what stays the same, and what you expect from the still.

Change one dial at a time when you experiment, then re-run. Batch changes invent ghost bugs.

Predict the still on paper before you type. Prediction turns running into confirmation.

Name each token in the still aloud. Hesitation marks the exact gap.

When something fails, read the last error line first. Calm retries beat rewriting everything.

Open-book means the page is a tool. Pick the claim that matches what we traced.

Keep mistaken traces beside corrected ones. The diff is the real lesson.

hello

print("hello")
Match this when you type. Open book.

Sit with that still. Trace it top to bottom. Name each piece. The exercise asks you to match its essence.

If something fails when you try it yourself, change one thing. Read the error. Return to the still. I will not rush you.

Quiz

What does print do in Swift?

Quiz

Are parentheses required on print(...)?

Quiz

Is Swift case-sensitive?

Quiz

Why start with print?

Quiz

Which call is valid Swift?

Quiz

Based on today's teaching, which claim is right?

Quiz

Based on today's teaching, which claim is right?

Check

Match the still for: Hello, Swift.

That is the lesson. When every quiz and exercise on this page is green, mark it passed. Next lesson when you are ready.

Open-book: the answers are on this page. Pass every quiz and check (8) to mark the lesson done. This visit: 0/8.

Hello, Swift · Swift (free) — The Gold Standard