Day 2 – Bools & Concatonation – 100 Days of SwiftUI

(I’m sorry for the post for this, being a day late! Was a bit busy yesterday, but i did do my lesson and notes yesterday).

Today (yesterday) I learnt about booleans in Swift. They are relatively easy to define:

let gameOver = false

and some functions that we have gone over in previous days return a boolean…

let isMultiple = 120.isMultiple(of: 3)

And we also learnt that we can reverse a boolean with ! (false becomes true and true becomes false.)

With joining strings we have two methods:

Using +

let code = "1" + "2" + "3"

OR

Using \()

let message = "Hello \(name)"

 

dylan

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment