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

Difference between Int and UInt32?

Can someone please explain this to me in detail? Also how can I convert it over to an Int if I have UInt32 value? (Please explain how I can do the opposite as well)...

Example code: var randomNumber = arc4random_uniform(12) var Number = 21 Number * randomNumber

Please help me! :)

1 Answer

Hi Egor,

In regard to the differences there are plenty of resources on Stack Overflow for example with the answer you're looking for.

As for your second question, Swift has the capability of converting UInt32 type values by simply passing the value with an new Int instance, see the below.

var randomNumber = arc4random_uniform(12)
var Number = 21

println(Number * Int(randomNumber))

Hope that helps.