Chapter    2

Declaring Variables and Constants

Programming is largely about solving problems with math, and to do that you need to store values and represent them in your algorithms. Most programming languages share a similar approach to storing values, yet the simplicity or terseness of syntax seems to be a differentiator amongst modern languages. Swift delivers a concise yet logical syntax that creates a harmonious balance between the coder and the compiler. This chapter will show you how to create stored values in Swift as compared with Objective-C, beginning with an explanation of how the two languages differ in approach.

Note  The phrase “stored value” is used interchangeably with “variable” and/or “constant” throughout this book.

Value ...

Get Transitioning to 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.