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

Christian Tisby
Christian Tisby
9,329 Points

In Swift, is Bool considered to be a numerical type?

I just did a quiz in Swift basics where the question was "Which of the following is not a numerical type?" A. Int B. Float C. Double D. Bool E. None of These

The correct answer was E. None of These, but Initially I chose D. Bool, which was incorrect. I understood Bool to represent true or false, not a numerical type. I'm confused as to why Bool was not the correct answer?

2 Answers

Heidi Puk Hermann
Heidi Puk Hermann
33,366 Points

Hi Christian,

the boolean type stems from the binary numbering system and can be translated into true == 1 false == 0 which is why it is defined as a numerical type.

Christian Tisby
Christian Tisby
9,329 Points

Thank you so much for this answer! I was really confused so I honestly didn't get it.