If you want to learn a programming language, whatever the language type, you have to use a variable, because the variable is something to accommodate data or information in programming.
Simply we assume that the variable is a container, take the example image above (the glass), the glass can be filled by the data, this time the data is water.
We have 3 glasses, the first glass is empty, the glass is half-filled, the third glass is full. If we write in MQL will be like this :
gelas1 = 0; gelas2 = 0.5; gelas3 = 1;
OK .. But in reality, the data is kind of different. Data is not always a number, data is sometimes a combination of letters + numbers + symbols. Officially MQL introduces several types of data that can be used (official link) but there are some important data types known, such data types include:
Here's an example of how to create a variable:
string nama; int nomorsepatu; bool menikah; color warnarambut; datetime tanggallahir; double tinggibadan; nama = "Mas HiLLzX"; nomorsepatu = 45; menikah = true; warnarambut = Black; tanggallahir=D'1985.07.19 12:30:27'; // Year Month Day Hours Minutes Seconds tinggibadan=175.50;
Congratulation! You have finished this article.