Discussing the article: "Master MQL5 from beginner to pro (Part II): Basic data types and use of variable"

 

Check out the new article: Master MQL5 from beginner to pro (Part II): Basic data types and use of variable.

This is a continuation of the series for beginners. In this article, we'll look at how to create constants and variables, write dates, colors, and other useful data. We will learn how to create enumerations like days of the week or line styles (solid, dotted, etc.). Variables and expressions are the basis of programming. They are definitely present in 99% of programs, so understanding them is critical. Therefore, if you are new to programming, this article can be very useful for you. Required programming knowledge level: very basic, within the limits of my previous article (see the link at the beginning).

Today we will talk about how data is stored in RAM. The data can be stored in memory as variables or constants.

The differences are obvious:

  • Variables can vary, that is the program has the right to rewrite such data.
  • Constants remain constant throughout the program lifetime, and if the programmer tries to overwrite their values, a compilation error will be returned.

Otherwise, their meaning is absolutely similar: this is a certain area of RAM that stores data, not processor instructions. Usually, people provide meaningful names for these areas of memory in order to understand what they are used for.

The compiler will remove these names, but if you have access to the source code (the text file), you can always understand the purpose of the variable based on its name. Provided, of course, that they are described correctly.

Constants may not have names in some cases. The programmer simply writes what exactly should be processed (for example, the strings that we passed to the Print function). Such nameless constants are referred to as literals.

In this article, we will take a closer look at the basic data types, ways to describe variables and constants, and the basic statements that a programmer can use to create algorithms. This in turn will allow you to create more useful programs than just "Hello, World".

Author: Oleh Fedorov

 
Thanks for trying... For me personally, this is another series of completely useless articles, no matter how much I want to learn....
 
Константин Сандалиди #:
Thanks for trying... For me personally, it's just another series of completely useless articles, no matter how much I want to learn....

I disagree. It is a normal article, where everything is described in detail.

Regards, Vladimir.

 
Константин Сандалиди #:
Thanks for trying... For me personally it's another series of absolutely useless articles, no matter how much I want to learn...
Konstantin, can you expand? Why "useless"? And what is needed to make it the other way round? I'll tell you straight away, I want to increase the output speed a lot. Is there something else?
 

I support the author, good article. I read it with interest just to refresh my memory of what I already know.

I have also come across people who were disappointed to find out that in order to master programming skills they will need to put much more effort and time into learning than they had originally imagined. Here success depends to a large extent on the individual person, but if you don't give up and continue to find and study other materials for learning, everything is possible.

 
Oleh Fedorov #:
Konstantin, can you expand on that? Why "useless"? And what is needed to make it the other way round? I'll tell you straight away, I want to increase the output speed a lot. Is there anything else?

Because I couldn't master MQL 4 on my own, and I also can't master MQL 5 on my own. And no matter what I read or watch, I don't understand! The level of my training is 0!!! And all the articles are for advanced users, who can just look in the documentation.... Rereading the incomprehensible several times is a dead-end branch of learning (cognition), "textbook" by S. Kovalev I learnt by heart as a poem could tell, but I do not understand what it says (writes).... All the more I can't keep in my head the incomprehensible and use it in practice. Perhaps, of course, there are unique individuals who grasp everything on the fly, but I do not. Only fundamental knowledge I can remember and use. I still want to study, but I can't find a teacher.

 
Константин Сандалиди #:

Because I couldn't master MQL 4 on my own, and I can't master MQL 5 on my own. And whatever I read or watch I don't understand! The level of my training is 0!!! And all the articles are for advanced users, who can just look in the documentation.... Rereading the incomprehensible several times is a dead-end branch of learning (cognition), "textbook" by S. Kovalev I learnt by heart as a poem could tell, but I do not understand what it says (writes).... All the more I can't keep in my head the incomprehensible and use it in practice. Perhaps, of course, there are unique individuals who grasp everything on the fly, but I do not. Only fundamental knowledge I can remember and use. I still want to study, but I can't find a teacher.

To the Teacher I am like to Beijing crawling, but I can already tell you something. I was in the same situation a few years ago when I started learning MQL5 programming language from scratch.

Question #1: what exactly is not clear to you in learning a programming language? Name at least one problem and specifically describe what is unclear in it.

Regards, Vladimir.

 
Константин Сандалиди #:

Because I couldn't master MQL 4 on my own, and I can't master MQL 5 on my own. And whatever I read or watch I don't understand! The level of my training is 0!!! And all the articles are for advanced users who can just look in the documentation.... Rereading the incomprehensible several times is a dead-end branch of learning (cognition), "textbook" by S. Kovalev I learnt by heart as a poem could tell, but I do not understand what it says (writes).... All the more I can't keep in my head the incomprehensible and use it in practice. Perhaps, of course, there are unique personalities who grasp everything on the fly, but it is not so with me. Only fundamental knowledge I can remember and use. I still want to study, but I can't find a teacher.

How many times I was convinced that in incomprehensible material, if it is presented sequentially, there is usually some fragment on which there is a "hitch": before it - everything is clear, and after it - dark forest .... A misunderstood notion, a misunderstood concept....

And as soon as this barrier is passed, all the material suddenly becomes crystal clear - until a new "hitch"....

Therefore, I will ask a couple of questions, which, of course, can be independently developed to infinity. :-)

  1. Do you understand what a programmer does in principle? (If you don't, you may look at my first article of this series and ask questions there in the comments about unclear phrases).
  2. Do you understand where to put the text files you write? And what to do with them after writing?
  3. Do you understand the concept of a function? The concept of a variable?

If the answers to all the questions are "yes", then your level of preparation is NOT 0!!!! If you don't know the answer to at least one question or the answer is "no" - try again to slowly reread the beginning of Kovalev, or my already published articles....

And practice! It's important. Open an editor, write code of examples (you can copy it, but it is better to do it yourself). Compile it and check what you have got.

And after that ask questions. At least in my threads, at least in parallel ones on the forum... On the request "newcomers' questions" search on the site gave me 202 pages of links, but nobody forbids you to create your own topic, if it does not duplicate existing ones.

Изучение MQL5 от новичка до профи (Часть I): Начинаем программировать
Изучение MQL5 от новичка до профи (Часть I): Начинаем программировать
  • www.mql5.com
Эта статья является вводной для целого цикла статей о программировании. Здесь предполагается, что читатель вообще не сталкивался с программированием раньше. Поэтому начинаю я с самых основ. Уровень знания программирования: абсолютный новичок.
 
Excellent. Look forward to the next issue
 

Hmmm... Another copy-paste of the certificate. Do they really pay $200 for this?

void OnStart()
{
   Print(-1<1 u);
   Print(-1*1 ull);
}

And who among neophytes, after reading the sections about literals and type conversion, will be able to tell what will be displayed on the screen without running this script?

PS. There's no trick here, just knowledge of literals and type conversion rules.

PSS. And yes, it's a question from the category of questions on a June interview.

 
Vladimir Simakov type conversion, will be able to tell what will be displayed on the screen without running this script?

PS. There is no trick here, just knowledge of literals and type conversion rules.

PSS. And yes, this is a question from the category of questions in a Jun interview.

Ahem... I am embarrassed to ask, but I have to....

  • How often do such constructs occur in real MQL5 code?
  • "June interview"... Does it mean that you personally have met large companies, one of whose main areas of activity is MQL? (Personally, I have not had to date).
  • And will this code produce the same results in all c-like languages?

In short, why does a neophyte need such a deep understanding of literals?


P.S. I personally, though far from being a neophyte, failed your test without answering a single question correctly. I met something similar in textbooks - either in Java or in PHP - but it was so long ago, and it doesn't correspond to the practical code I had to read or write until now... I'm not going to be a june in your office. So... what?

P.P.S. I think that if you write an article about literals, it might be useful not only for me. ;-) Especially if you share your experience, which is not in the help.... However, undocumented features usually embarrass me a lot, because they change too often in new versions, but, you never know.... Maybe it will be really important or at least useful?