Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Swift Basics Swift Types Numbers and Booleans

I haven't comprehended the Bool usage in coding. What do they do?Why do we even use true or false?

Are the Booleans an argument apart or they're used for numbers?

51,495 Points

I asked myself the same question when i started coding. I think you will understand the usage trough time. I use booleans for checking e.g. if somebody is logged in. In this case you create a variable called isLoggedin and set it to true or false. The short syntax of checking if the variable is true or false is "if isLoggedIn {}". You don't have to write "if isLoggedIn == true {}". You will come over more examples if you continue with Pasans courses.

Wow i just finished the exercises after this video and realise it's a really simple concept... Thank you for the example!