Curious about programming?
Programming isn’t as difficult as it used to be. Languages have evolved to be more easily understood. This means good things for technology and advancement in general. You don’t have to spend years learning a programming language. In fact, there are key concepts that are used in each language. You can concentrate on these main concepts to help get up to speed with any coding language that you want to learn.
Setting a Variable
The first concept that you will need is the ability to set a variable. A variable is a way to assign something (a value or way of doing things) to a reference or place holder. This is a bit like calling something an automobile a Car rather than saying something like, “That large red thing over there with four wheels sitting by the curb”. By calling it a car we are creating something we both can use to refer to something (a reference).
This is an important concept in programming in that the things that we need to “remember” or “refer to” are often hard to describe. For example, a large number (3.14159265359) or a bit of code such as () => { return true }. ( try describing that to someone!)
Example
Here is an example of how a variable is set in the JavaScript language (very popular these days).
cost footInInches = 12
Let’s break this down.
- First is const this is short for constant (a value that will not change)
- Second, footInInches is the name of the reference
- Third is the = this assigns or equates the name with the thing to the right of the equal sign
- Fourth, the assignment value or thing we are referring to
As a side note, the fourth part of the line of code (the value) doesn’t have to be a number. It could be a word, a equation, or even refer to another code file. This is the first concept that starts to open up the world of programming to endless possibilities.
Next concept we will talk about functions (article coming soon)