11

I am teaching myself to program using Swift 3, and I am currently learning about booleans. I noticed that if I want to explicitly declare my variable of type bool, I have two options

Bool

or

Boolean

I was wondering why we have these two options if they are the same? Well, are they the same? This is what I'm confused about.

Thanks in advance.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
AmaCode
  • 143
  • 1
  • 7
  • 2
    Swift native type is Bool – Leo Dabus Nov 24 '16 at 01:55
  • 1
    Where do you see `Boolean`? If I try to use that as a variable's type it shows an error. – rmaddy Nov 24 '16 at 01:57
  • @rmaddy the tutorials I was watching were a bit old and the guy said to just google it if we wanted to know the reasoning, in the current version of Xcode we can no longer do it, but I was just asking because I was curious. – AmaCode Nov 24 '16 at 02:02
  • 6
    `Boolean` used to be an alias for `UInt8` in Swift 1.x for "historic reasons", compare http://stackoverflow.com/questions/27304158/type-boolean-does-not-conform-to-protocol-booleantype/27304432#27304432 – Martin R Nov 24 '16 at 05:47

1 Answers1

5

Bool is Swift's boolean data type. Boolean hasn't existed since the early days of Swift.

Alexander
  • 59,041
  • 12
  • 98
  • 151