Run your first Swift program
Meet `print`, constants, and Swift’s clean syntax.
- 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.
print("Hello, Swift!")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.
Print a welcome line
Print exactly Welcome to Swift! on one line.
- Welcome line
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…