Control Flow (if statement)

I'm so new to this sorry if there is already something out there regarding it. It can't seem to find it.

Here is what I'm trying to do:
var balance = 7000

if balance >= 5000 {
print("You have the money for this trip. Let's go!")
}

I can't seem to get the string "You have the money for this trip. Let's go!" to show on the results side bar of MyPlayground. Only shows 7000.

This is more of a question about your IDE than about Swift, but assuming you're talking about Xcode, the output of print statements doesn't show up in the right sidebar. It appears in the so-called Console, which is usually at the bottom of the window. Select View > Debug Area > Activate Console to show it.

2 Likes

OMG I'm so sorry if that was a noob question. Which I am and yes I see it now. I could not figure it out. Thank you so much!

1 Like

No problem!

1 Like

Glad you figured it out. It bears emphasizing, questions of all levels about how to use the Swift programming language are welcome! This is exactly what this "Using Swift" category is all about!

(A small tip for future posts: if you indent your code or use ``` on the line before and after, you can make your code appear as a code block with syntax highlighting and everything. When examples get complicated this can help people to read your question more easily.)

3 Likes