Variables. You've heard of them, but what are they? The word is used in a number of different ways, and it means a lot of different things. In order to get a solid iOS foundation laid, you need to understand the importance of variables. To begin, lets talk about one of the other places you may have experience with variables: math.
Consider this simple algebraic equation:
6y - x + z = 4
What is x? Is it a number? What is it's value? The answer is that the variable x is whatever you want it to be. This is really important to understand. Programming variables are quite a bit different and more powerful than math examples, but the idea is the same. You use a letter or a word to represent or hold a value.
So how do I use variables in programming?
In programming, there are a number of different variable types. Like I mentioned before, variables are placeholders for data. The type of data that a variable holds depends on the type of variable that it is. Here is a rough overview of the 4 basic types of variables you will need for a solid foundation in iOS development:
Integers - This variable type holds simple whole numbers like 3.
Doubles - This variable type holds numbers with decimal values like 3.14
Boolean values - This variable type can be one of two different things: TRUE or FALSE.
Strings - This variable type holds a string of text characters like "text".
These four basic data types are the core building blocks of computer programming (not exclusive to iOS). It is important to understand their difference, and when you want to use one over the other.
In my next post, I will go over how to use these variables. Stay tuned!
No comments:
Post a Comment