You are on page 1of 3

MQL4 COURSE

By Coders’ guru
w w w . f orex -t sd. c om

-E x e r c i s e 2-
S Y N T A X
--------------------

Q u e s tio n 1
SYNTAX in MQL4 is the studying of its grammar and writing rules which consist
of

1- F ormat.
2- C omments
3- I dentifiers
4- R eserv ed words

… … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … …

Q u e s tio n 2
Which sentences of the following are false, and why?

1- When you write your code, you can freely use any set of sp aces, tab s and emp ty
lines you want to sep arate your code and your line of code to mak e them readab le
and eyes p leasing.

(True)

Why:

2- You can use “ / / ” symb ol to comment Multi lines b y starts the line with “ / / ” and
ends it with “ / / ” .

(F alse)
Why: The “ / / ” symb ol is used for signle line commenting, the symb ol for Multi lines
comments is “ / * ” at the start and “ * / ” at the end.

3- These k eywords are reserv ed words in MQL4 which you can use them as name
for your identifiers:

b ool,white,C olor,case,b reak ,do and E x tern

(F alse)

Why: Not all the k eywords here are reserv ed words.


b ool,case and b reak are reserv ed words, while:
white and do are not reserv ed words.
C olor is not reserv ed word, b ut “ color” is the reserv ed one.
E x tern is not reserv ed word, b ut “ ex tern” is the reserv ed one.

… … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … …

Q u e s tio n 3
Which of the following is a v alid code and which is inv alid, and why?

1-
ex tern int / * H E LLO ! I ’ m a comment* / MA_ P eriod= 13;

(V alid)

Why:

2-
int 3P eriods;

(I nv alid)

Why: You can start your identifier name with a numb er.

3-
string _ MyString = “ Welcome” ;
(V alid)

Why:

4-
doub le
MacdC urrent,
MacdP rev ious,
SignalC urrent;

(V alid)

Why:

5- color C olor= C ' 128 ,128 ,128 ' ;

(V alid)

Why:

You might also like