# iOS For High School Students: Getting Started

This is a blog post by Connor Osborn, an aspiring student with a passion for creating software and 2d games! This is a new tutorial series on beginning programming for iOS – for high school students, by high school students! We’ll walk you through creating an app from the very beginning, assuming zero knowledge! And we’ll make […] By .

Leave a rating/review
Save for later
Share

35 mins

## The Infinite While Loop

The final and most important part to the "Are You A WIZARD?" program is about to be revealed. Up until now there has been no possibility for a user to generate a wizard class, so we must create an output for one who possesses the greatest traits. Right now an input of (10, 10, 10, 10) results in the following output (or lack thereof):

In order to change this, we are going to create an infinite loop (for fun)! This is where we use the sum variable. (Wondering what had happened to that, huh?)

While we use the operator "=" to assign a value to a variable, the double "==" means "equal to," a key distinction. The only time that the sum of all four skills can equal 40 is if they are each 10. Paste this on the line before your first if statement. Make sure you understand what this is saying.

```	while (sum == 40)
{
NSLog(@"You are a WIZARD! You cannot be defeated!! This simple program loops in honor of you!");
}
```

A while statement will execute the command until the condition is no longer met. This statement reads "while the sum equals 40, print the NSLog statement." Run the program, and see if you qualify as a wizard. :p

## Where To Go From Here?

Here is an example project with all of the code from the above tutorial.

I hope that this tutorial was helpful in your pursuit of programming! Now that you know the basics, you'll be coding on your phone in no time! :]

From here you can move on to the second part of the series, iOS For High School Students: Text Adventure Game, which will walk you through creating an app from the very beginning.

This is a blog post by Connor Osborn, an aspiring student with a passion for creating software and 2d games!