Swift Program Structure

In this first section, we'll look at the basic language syntax for Swift, and you'll write your first fully functional Swift program.

Like many modern programming languages, Swift draws its most basic syntax from the programming language C. If you have previous programming experience in other C-inspired languages, such as C++, Java, C#, Objective-C, or PHP, many aspects of Swift will seem familiar, and many Swift concepts you will probably find quite familiar.

We can say the following about Swift's basic syntax:

  • Programs are made up of statements, executed sequentially
  • More than one statement are allowed per editor line when separated by a semicolon (;)
  • Units of work in Swift are modularized using functions and organized into ...

Get Beginning Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.