Table of Contents
When students start learning to code, they are taught many basic concepts. Learning a new programming language is similar to learning a new language in the sense that you already know another language in your attempt to become bilingual.
For example, if you know English and are trying to learn Spanish, teachers will only teach you pronunciation, grammar, and vocabulary. They won’t teach you to write the script from scratch because the script is still composed of English letters.
Similarly, when you as a coder, are learning a new programming language, you will need to know some basic concepts that are present across almost all languages.
If you are attempting to learn Solidity then here are five basic concepts you should know before trying your hand at Solidity programming.
Functions are used in almost all coding languages to execute a specific job. Teachers often start with a print function to show what functions are and how they can be used in programming.
Programming languages have some common functions across all languages but functions can also be language-specific.
When you start your Solidity tutorial, you will learn many Solidity-specific functions that will give you better insight into the power of the language and its use. After finishing this, you are ready for advanced Solidity training.
An example of using functions would be something like creating a function that takes several numbers and averages them.
Once you create a function, you can just use that averaging function to average instead of having to type out the entire formula each time.
Integers in coding are exactly what they are in math. They are whole numbers that cannot have a decimal point or cannot be a fraction.
However, integers can be negative or positive. If you try to store -2.5 in an integer field, depending on your programming language, the number will either be truncated to just -2 or show an error.
Integers are useful throughout any programming language whether it is to carry out basic operations or build advanced algorithms.
If you do want to use decimals, many languages such as Python or C require you to declare it as a float instead. A float can be used to describe any number that has a decimal point and is either positive or negative.
This is precisely why it is necessary to learn the basics before you go about learning the advanced features of each language. These small mistakes can make learning quite frustrating if you jump head-first into it.
They can also make your code riddled with errors that could have easily been avoided.
Variables in coding also work similarly to how they do in algebra. A variable can store almost anything you want.
For example, if you tell the program that the variable x accepts an integer value and you input 3768372, you can now use x wherever you want instead of having to type the number again.
Learning variables and understanding when to use them is the first step to upgrading your tech skills. Variables can be very helpful when you are constantly using the same values or updating information based on the functions you run.
Strings are one of the easiest-to-understand concepts in programming as they follow English rules. Their use can be quickly understood by novice programmers and strings are useful in almost every programming language.
A string is essentially just a sequence or string of letters that can be stored in a variable or printed when needed. They are most often used for letters, however, depending on the language you are coding in, they can be alphanumeric too.
A common example of a string is used in an error message when the user is prompted to input some text.
For instance, when you type your password to log in to any portal, a wrong password attempt will often lead to a pop-up that says “password is incorrect, click here to reset password”. This error message is a string.
Once you understand integers, variables, and strings, you will quickly realize how small these are compared to the amount of storage you might need.
For example, if you need to use 300 different integers over and over again in a program, you will need to create 300 variables that are set to integer parameters with each value.
This is where an array comes into play. An array is essentially a collection of values or data which can store the same type of data.
You can create an integer array, add all your 300 values in the array and just call the array name every time to simplify your program.
Once you learn or master arrays, you will be able to use matrices too which are just extended arrays.
You will also have to remember how indexing works to be able to call the exact position of a number in a matrix.
Before you start programming in Solidity, make sure you brush up on your basic concepts as Solidity is better understood by those that already have a basic understanding of coding.
These will help you become a better programmer overall regardless of the language you choose to progress your career and perform better in coding interviews.
Since coding interviews often require you to simplify and optimize your solutions, not knowing how the basics affect your code can make this extremely difficult. Hiring managers and interviewers will look for basic skills before they decide if you should be hired.
Additionally, you should also read and research a little bit about blockchain and Ethereum as they will be frequently mentioned in any Solidity course that you take.
An understanding of how the blockchain works, what a decentralized network is, and how Solidity fits into this will help you better understand what exactly you are doing.