Programming in Swift - Part 6: Part 1: Core Concepts: | Ray Wenderlich

Learn how to use a Swift type called Booleans, which represent true or false values.

This is a companion discussion topic for the original entry at

This topic was automatically closed after 166 days. New replies are no longer allowed.

Error with this code
error: MyPlayground.playground:44:1: error: variables currently must have an initial value when entered at the top level of the REPL
let min: Int
let a = 50
let b = 10

let min: Int
if a < b {
min = a
} else {
min = b

However this works! let min = a < b ? a : b

@hb19xx The above code actually works in Xcode playgrounds. Do you still get errors when you run it in REPL?