enum Archives

How to create your own Data Type using typedef

With typedef you can specify custom variable types. Instead of having a variable such as int, you could create your own – such as yourInt: // create a typedef of int typedef int yourInt; yourInt yourValue = 57; NSLog(@”Your value is %i”, yourValue); Now you have your own variable type called youInt which behaves just […]

How to create an Enumeration (enum)

An Enumeration (enum) allows you to create a collection of custom values. These can be more meaningful than simply using numbers. Imagine you want to track drink sizes, such as small, medium and large. You can remember to just use the numbers 1, 2 and 3 for each size – but Enumeration makes it easier […]