4/15/2023 0 Comments Xcode c programming tutorial![]() ![]() Here’s how our variable looks in the playground: A complete example of the variable declaration is given below. ![]() Since we named this variable “firstName,” we’ll give it a piece of text data, namely the word “Tom.” Note: the single equal sign lets us assign a piece of data to the firstName variable. For example, if I had a piece of data for someone’s first name, I might name my variable firstName.įollowing your variable name, add an equal sign and then the piece of data you want to keep track of. You can name it anything you want, but the name should clearly describe the data the variable will contain. First, type the keyword var, followed by a space, and your variable’s name. Let’s learn how to create, or declare, a new variable to track a piece of data in memory. This is where variables come in, to help keep track of data within an app. For us to work with data, we need a way to refer to it in our programs. Your computer stores data in its memory to keep track of where the data is and what it is. ![]() We can even have text data like "Hello" surrounded by double quotes on line 5. Data can be numbers like 123 and the decimal 0.7 as shown on lines 3 and 4. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |