Not into coding? That’s fine too! We’ll still bring in CSS and HTML5 because these can help you achieve professional quality aesthetic design with little effort due to how simple they are.
If you don’t already have one, create your own free account on Bitbucket which is a code hosting site like github. You can use either. Both are free. I’ve chosen Bitbucket in this post because I personally like it better, but feel free to choose whatever you want.
Variables and Loops
Variables is a programming concept that allows you to store information. What kind of information? Well, it’s up to you! If you want to store your dog’s name (because clearly he or she is the most amazing thing in the world), how much money you have, or even if you want to store a table of websites – it’s all possible with variables. What we’ll be covering in this article is the creation and use of numerical and string variables (we’ll cover why these two types of variables exist below).
But what if you want different variables? Easy. Just copy and paste the code above onto the bottom of your script line (so that it’s on more than one line) and just change mydog to another name that you prefer. However, if you want multiple instances of the same variable (eg. 100 of your dog), copy and paste it more than once on the bottom of your script (in exactly the same format) and change each instance of mydog to whatever new name or number you prefer. (Hint: You can add code such as for (var i = 0; i < 100; i ++) to the script line).
Now you’re probably thinking: “Well, what about strings?”.
If you’ve played around with HTML and CSS, you’ve probably encountered strings. What are strings? You can think of it like this: A string is a series of characters (ie. letters and numbers) that we use to define words and phrases.
How can we define words and phrases?
Answer: By defining a variable that holds a string called “dog”. Now we can get creative with our dog variable. How about if we want to define a phrase that says “I love you”. We can do this with the following code: dog = “I love you” .
This is just scratching the surface of how variables work, but hopefully it’s enough to get you started.
If you want to learn more about the use of variables in programming, check out this tutorial .