If you are curious about programming, you can start with writing your own scripts. This article will show everything you need to know about scripts.
How is programming working?
The very basics of each programming works something like these, you tell the computer to do something to some piece and bits of a data. For instance, calculate 2 + 2 which results in 4. You see the idea here? You specifically give the computer some form of data, in our case 2 + 2 (a number is added to another number ) it gives you an output, which is a number again. But forget about the computer, let’s say I tell you to calculate, 2 + goo. How would you calculate this without making a face here? It does not make sense right?
So, computer takes everything in such way as well, but for computer it takes things very literally. Therefore, computers always work with some data types. This nothing crazy, let’s look at them.
Data type
Continuing from the example of the 2 + goo, to make distinction between these numbers, computer distinguish them with their own types. For instance, 2 is an integer and goo is a word but this is in terms of programming called ‘string’ which computer understands. The addition symbol here is called an operator . There are also other bunch of data types and some language can have additional data types then the general data types that all languages understand. Yet, we are not going to get into such details here. You can always look them up if you decide to study this subject in depth.
Variables
The majority of computers will calculate some value and as soon as it is done, it will forget it. For instance, if we were to calculate 2 + 2, as soon as the result is calculated, computer doesn’t bother remember them, unless you specifically tell the system to remember the numbers. This is where variable comes in play. You can think of variables as container which computer remembers. You could do something like this – x = 2, y = 2 , now if you do x + y it will give you the same result.
Conditional and basic loops
Conditionals and basic loops are one of the most important part of any programming. You can write your script based on certain conditions and how many times some task should do some task. For instance, if the temporary files are around the threshold, put the function on a loop and clear temporary files from the system based on other conditions.
Environment variables
An environment variable is something that store some value which is open to the system globally, meaning can be accessed from anywhere from any medium in the system. You as a user can set it, script or programme or the shell it is running in are able to set an environmental variable.