Um momento
0x00Lesson 1 of 7

Run your first Swift program

Meet `print`, constants, and Swift’s clean syntax.

15 min 5-question quiz 1 code exercise
By the end of this lesson you can
  • Write and run a Swift program that prints a message.

Swift is a modern, strongly typed language focused on safety and readability. A small Swift program can run with top-level statements, so you can start learning without ceremony. The language powers apps, servers, scripts, and systems code.

main.swift
print("Hello, Swift!")
Output
Hello, Swift!

Swift 6.4 is the latest stable language release, and this track teaches current Swift style. Exercises run on Swift 6.0.1 in Wandbox, so examples avoid newer syntax that would fail on that runtime.

Key takeaways

  • Write and run a Swift program that prints a message.

  • Swift favors clear intent and safe defaults.

  • Compiler feedback is part of the learning loop.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Practice: write Swift

These run for real. Write the program, press Run tests, and read what the compiler tells you - learning to read compiler messages is half of learning C.

Exercise 1

Print a welcome line

+25 XP

Print exactly Welcome to Swift! on one line.

  • Welcome line
main.swift
Loading editor…

Swift lessons are authored for Swift 6.4; exercises run on Swift 6.0.1 via Wandbox, a free public service. Your source code and test input are sent to that service.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: