Now that you've suffered (hopefully not) through reading the author's note, possibly the set up section, and chapter 1, we're ready to actually start programming! *cue fireworks*
Programming has a lot of algebra in it, and I won't sugarcoat it, because it can get confusing. But, if you use a thing I like to call "common language", then it will minimize the head scratching. I'll get into that a little later. The first thing you want is to know what you're going to program. You can't write a book without knowing what to write about. You can't play a sport without knowing which sport you will play. So, before you ever program something, know at least what you will be programming.
Algebra is the part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formulae and equations according to the Merriam-Webster Dictionary. Algebra is also what makes up the majority of programming. Variables are symbols or letters that represent numbers. To create a variable, we must declare it. There are multiple ways to declare a variable, and each one of them are different. Here's a chart of what each type of variable does:
[chart of variable names]
As you can see, there are a lot of them. You can "declare" what a variable is by typing in this:
[picture of declaring a variable]
Followed by what value you want the variable to be.
[picture of variable with value]
You can declare a variable like this:
[picture of a variable without value]
But it will not have any value assigned to it. Various variable types have a default if you don't assign a value to the variable like this. For example, int will default it to "0" and boolean will default it to "true". Note the semicolon at the end. Semicolons signify the end of a command. Declaring a variable is basically a command that says "hey, create this variable now".
You can name a variable anything you want, as short or as long as you want. It can be a single letter, or it could be a string of words. I prefer to name my variables in a short string of words to I know what it does. Like this:
[picture of a string of words variable]
I would highly recommend using this way to name your variables. Trust me, when you have a big program doing multiple things, knowing what each variable does just by looking at it is infinitely more helpful than seeing " z". Rather than "z", name it "FirstInputNumber".
Programming has a lot of algebra in it, and I won't sugarcoat it, because it can get confusing. But, if you use a thing I like to call "common language", then it will minimize the head scratching. I'll get into that a little later. The first thing you want is to know what you're going to program. You can't write a book without knowing what to write about. You can't play a sport without knowing which sport you will play. So, before you ever program something, know at least what you will be programming.
Algebra is the part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formulae and equations according to the Merriam-Webster Dictionary. Algebra is also what makes up the majority of programming. Variables are symbols or letters that represent numbers. To create a variable, we must declare it. There are multiple ways to declare a variable, and each one of them are different. Here's a chart of what each type of variable does:
[chart of variable names]
As you can see, there are a lot of them. You can "declare" what a variable is by typing in this:
[picture of declaring a variable]
Followed by what value you want the variable to be.
[picture of variable with value]
You can declare a variable like this:
[picture of a variable without value]
But it will not have any value assigned to it. Various variable types have a default if you don't assign a value to the variable like this. For example, int will default it to "0" and boolean will default it to "true". Note the semicolon at the end. Semicolons signify the end of a command. Declaring a variable is basically a command that says "hey, create this variable now".
You can name a variable anything you want, as short or as long as you want. It can be a single letter, or it could be a string of words. I prefer to name my variables in a short string of words to I know what it does. Like this:
[picture of a string of words variable]
I would highly recommend using this way to name your variables. Trust me, when you have a big program doing multiple things, knowing what each variable does just by looking at it is infinitely more helpful than seeing " z". Rather than "z", name it "FirstInputNumber".