As soon as we write even the simplest program in any programming language, we have to keep track of pieces of information. If we are building a loan calculator, we need to keep track of the amount of the loan, the number of months, the interest rate. If we are writing a game program, we might need to know the current score, the position of the player on the screen, how many lives do we have left, what image do we use for our player. This is all data and we create variables to hold that data.
No other characters are allowed but you can't actually start with a number. So this variable name for example would not work, but reversing them so the number's at the end, that would work, and we will talk more about naming our variables later on when we talk about style guidelines, but I am just going to use simple names for now. All we are doing when we create a variable is carving out a little area of memory to hold a value. Right now after this line of code runs, this variable exists.
So be careful when you're naming your variables. Now if you are creating multiple variables at the same time, you can of course do them on multiple lines like this but you can actually combine them on to one line, separating the variable names with commas. It's just a shorthand way of doing this. And similar to that if you're actually creating multiple variables and giving them all initial values you can still combine them on to one line. This makes it a little easier to read, a little shorter to write.
Finally, the course compares how code is written in several different languages, the libraries and frameworks that have grown around them, and the reasons to choose each one.
- Writing source code
- Understanding compiled and interpreted languages
- Requesting input
- Working with numbers, characters, strings, and operators
- Writing conditional code
- Making the code modular
- Writing loops
- Finding patterns in strings
- Working with arrays and collections
- Adopting a programming style
- Reading and writing to various locations
- Managing memory usage
- Learning about other languages