Group Group Group Group Group Group Group Group Group Forums

Swift Tutorial Part 1: Expressions, Variables & Constants

In Part 1 of this tutorial mini-series, you'll learn how to work with playgrounds in Xcode 8, and how Swift handles variables, expressions and constants.

This is a companion discussion topic for the original entry at

Always enjoyed and learned from reading your tutorial/books…enjoyed this time also … Hope we will get chance to read effective swift this time… waiting eagerly !!! :slight_smile:

Nice tutorial! I especially like the use of the underscore when setting the value of a variable to make it more readable.

I’m curious, though, why the Xcode sidebar displays the value of variableNumber as 1000000 instead of 1,000,000 as is shown in the screenshot in the tutorial. I thought maybe it had to do with the NSLocale.current.identifier settings (I’m set to en_us) vs. what you may be using in the UK, but when I look in the System Preferences > Language & Region I see that it is supposed to use commas in numbers. Is this maybe an Xcode preference setting?

Just a small correction… I don’t know if it has already been brought up, but 360˚ is not 2 radians but 2π.

Hi everyone,

I just downloaded XCode for MAC.

When I wrote your code, @mattjgalloway, I didn’t see any results on the right sidebar (results pane).

Did you know why I can’t be able to see them?

Any help would be welcome.
Nice tutorial.

Best regards,


This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]