Swift Programming For Complete Beginners Part 6: String Interpolation & Type Conversion

September 23, 2018 | Swift, Beginner

In this series we've done a lot of printing to the console. We've printed strings and constants and variables of other types. But it's often useful to be able to insert constants or variables directly into strings, especially when those constants or variables are values of other types. For example, when you want to say "Hello, [name]!" or "The bank account ending in [lastFourDigits] has a balance of [accountBalance]". In the bank account example . . .

Swift Programming For Complete Beginners Part 5: Conditional Logic

September 23, 2018 | Swift, Beginner

A programmer's wife tells him to go to the store and get a loaf of bread. As he's leaving, she says "if they have eggs, get a dozen". The programmer comes back with 12 loaves of bread. A programmer's husband tells her to go to the store and says, "while you're there buy a dozen eggs". She never comes back. Programming is . . .

Swift For Complete Beginners Part 4: Functions

September 22, 2018 | Swift, Beginner

Functions are pieces of code that perform a specific task. A function can also be thought of as a set of instructions packaged together. In Part 1, you used the built-in Swift function `print` to output values to the console. So far you have used it to output "Hello, World!", "Hello, Xcode!", pi, and an email address. When you use a function . . .

Swift For Complete Beginners Part 3: Types

June 16, 2018 | Swift, Beginner

In Part 2 you learned how to declare constants and variables. When we declared `let pi = 3.14159` or `let email = "test@example.com"`, we didn't seem to care too much that one is a number (pi) and the other is text (an email address). However, you probably noticed that pi was declared without quotes while the email address was . . .

Swift For Complete Beginners Part 2: Constants and Variables

May 8, 2018 | Swift, Beginner

You've set up Xcode and wrote your first program, but you probably don't yet understand how the code you wrote works. That's OK, we'll get there! In this tutorial we'll learn about two of the basic building blocks of computer programs, constants and variables.