The second project for iOS pre-course using variables.
- Read Types & Variables intro on DevMounta.in
- Another very good resource is Code with Chris's Core Programming Concepts
- For Objective-C visit RyPress's C Basics
- For Swift you should of course read Apple's documentation.
- For Swift there is also a very simple intro at iOS Creator or a more detailed introduction at Tuts+
- Either create a project locally and push to GitHub
- Or fork this project and clone it to your computer
Note:
- For more detailed instructions of 'Step 1' see the first project
- 'Step 1' is something we will do hundreds of times in class. You need to be able to do it quickly and without running into issues so it doesn't slow class down.
- Remember that we're working in the AppDelegate file in the "didFinishLaunchingWithOptions" fuction
- Declare two variables (height and weight with the type CGFloat)
- Store values in each of them (height = 71.0 and weight = 185.0)
- Declare a new varriable (bodyMassIndex with the type CGFloat)
- And set it to (weight / (height * height)) * 703
- Log the weight to the console
- It should print that the BMI is 25.799444
- Feel free to play with the height and weight and see what gets printed