MQL5Book/Scripts/p2/StmtExpression.mq5
super.admin 1c8e83ce31 convert
2025-05-30 16:09:41 +02:00

33 lines
1.2 KiB
MQL5

//+------------------------------------------------------------------+
//| StmtExpression.mq5 |
//| Copyright 2021, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
// errors:
// 'Print' - unexpected token, probably type is missing?
// 'Hello, ' - declaration without type
// 'Hello, ' - comma expected
// 'Symbol' - declaration without type
// '(' - comma expected
// ')' - semicolon expected
// ')' - expressions are not allowed on a global scope
//
// Print("Hello, ", Symbol());
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
int i = 1, j = 2;
i + j; // warning: expression has no effect
Print("Hello, ", Symbol()); // ok: prints greeting in the log
}
//+------------------------------------------------------------------+