![]() ![]() You must combine them into one word like the following: totalCats = 3.5 You see, our variable name must be one word. This “camel case” makes it easier to decipher multiple words. Here are more examples: numberOfDaysInMarch = 31 This is a standard programming practice when naming variables with multiple words. I lowercased the first letter of the first word and uppercased the first letter of each subsequent word. 5 refers to a kitten, you monster), but rather the variable names. I’m not talking about the half of a cat (the. Now, you may have noticed something amiss in the previous examples. The following will cause an error being it is missing the end quote: myQuote = "this space for rent. You always must have two quotes a start quote and an end quote. Or you can use text: myQuote = "this space for rent."Īll text-based variables (otherwise known as strings) must be put in quotes. You can have true and false values: isHungry = true You can also use decimal: totalCats = 3.5 ![]() In the previous example, you saw number variables. With Twine, we get lots of variable types. The meaning is the same ten sodas or otherwise a terrible hyperallergic sugar crash. If you wanted to be tricky, you could say: I had cats + dogs sodas last night. ![]() You would mean: I had 15 sodas last night. If you were to say: I had pandemonium sodas last night. Now, whenever you refer to pandemonium, you’ll be referring to the value of 15. Here’s an example of variables in action: cats = 5Ĭan you guess the value of pandemonium? Take all the cats and add all the dogs, and then you get the number 15. They are called variables because the containing value may change. Variables are small parcels of information that you pass around in your story. Understanding Variablesīefore you start writing code, you should have a good idea about variables because you’ll be using LOTS of variables in your stories. This sounds difficult, but trust me, you’re going to be a pro. Add a difficulty selection to your story.In this tutorial, you’re going to be doing some Twine coding. After all, a computer language may dozens of words whereas a language has thousands and thousands of them. Language is a far more complex code (by orders of magnitude) than anything written for a computer. Heck, by reading this, you already show an amazing aptitude for deciphering code. To my young daughter, I had just spoken some bizarre incantation, but my wife knew exactly what I meant. “Lizzie, after we put Fiora to bed, do you want to have I-C-E-C-R-E-A-M”. As a parent, I remember employing a simple code to hide my intent from my then toddler. Some code is made up on the fly while other code is rooted in technical documentation. You will get started on this journey by creating some Twine variables. Believe it or not, coding isn’t that hard. This is the part where we type obscure symbols that only a few select people can ever understand. The part of this tutorial series that some of you have been dreading: coding. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |