Viewers: in countries Watching now:
iOS app development is actually simpler than you might think—even if you're not an experienced programmer. In this course, Todd Perkins bundles the most important concepts in iOS into a quick course, explaining the development process in a visual way that people of any background can understand. No programming experience required! At the end, you'll have a finished app and a basic understanding of Xcode, the toolset for developing iOS apps; building blocks like variables, functions, and conditional statements; and interface design. You can also figure out if an iOS learning path is right for you, without a lengthy time commitment.
If you find you'd like to learn more, see iOS App Development Essential Training, Foundations of Programming: Fundamentals, or any of the other programming courses in our library.
Variables are the most basic building blocks of programming. So what are variables? They are the nouns of programming. And that means that they are named containers that hold data. This data can be a number, text, or more complicated value. For example, a user's score in a game would be held in a number variable. In code, variables are created by declaring the data type.
So, for example, if the variable is going to be a number, you want to declare that the variable will be holding number data. Variable has a name. For example, if you're going to create a score in a game, you could call that variable score. You set the value of a variable using an equal sign. And you end programming statements with a semicolon. Think of it like a period in a sentence.
So let's look at an example of a variable in code. This line of code creates a number variable called score and sets it to the value of 100. The first word is int. Int is the data type of a variable. That says that the variable is going to be an integer, or a whole number. It doesn't have decimal points. Score is the name of the variable. The equal sign says, after the equal sign, I'm going to set a value for the variable.
100 is the value set for the variable, and the semicolon ends the statement. When you're naming variables, you have to follow certain rules. First, start with a lowercase letter. Use only letters, numbers, and underscores. And use camelCase where each consecutive word starts with a capital letter. Now, you don't have to do that. It just makes it easier for reading your variable names.
Finally, don't use reserved words. In the last slide, we looked at how int declared that score was going to be an integer. So, you couldn't have a variable that's named int as well. Now, there's a special convention that you can use to make sure that you're not using reserved words. And that's the color of your text when you type it out in Xcode. So, you're going to watch for those color changes. If you type a word and the color changes all of a sudden, then you know that you're using a reserved word. Now there are, of course, some exceptions to that, and we'll look at that a little bit later on.
But for now, follow these conventions and you can create variables with ease.
There are currently no FAQs about Programming for Non-Programmers: iOS 7.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.