Download MetaTrader 5

How to / Where to use enum?

To add comments, please log in or register
Sherif Hasan
7392
Sherif Hasan  

Hi,

Question as above?

I tried some code here. but it shows many error!

can anyone show me exact example to use enum? i tried search googling, no use?

enum CurrencyEnum
  {
   EUR,  
   USD,  
   GBP, 
   AUD,
   Something_else  // Other currencies
   
  };
  
extern CurrencyEnum currency = EUR; 
Keith Watford
Moderator
10638
Keith Watford  
What errors are you getting?
Sherif Hasan
7392
Sherif Hasan  
GumRai:
What errors are you getting?
CurrencyEnum' - unexpected token
currency' - expression on global scope not allowed
currency' - variable not defined
EUR' - expression on global scope not allowed
EUR' - variable not defined
enum' - expression on global scope not allowed
enum' - variable not defined
CurrencyEnum' - expression on global scope not allowed
CurrencyEnum' - variable not defined
{' - expression on global scope not allowed
'EUR' - variable not defined
'USD' - variable not defined
'GBP' - variable not defined
'AUD' - variable not defined
Keith Watford
Moderator
10638
Keith Watford  
Look at the code above the code that you have posted, you have probably made an error there as ther is nothing wrong with your enum as far as I can tell
Edward Hirsch
701
Edward Hirsch  
enum menu7 {
   menu7_0, // Server >>
   menu7_1, // PC >>
   menu7_2, // GMT >>
};
input  menu7  TimeClock=menu7_2;
type in all including the symbols //
whroeder1
15692
whroeder1  
CurrencyEnum' - unexpected token
Stop there and look at the code above that line.
James Hodges
3938
James Hodges  
Yes as WHRoeder mentioned, you need to look above the enum. Those errors seem to indicate that above that area you have some code that is either missing or has an extra closing bracket. With out seeing the code around your problem it's impossible to say. It has something to do with opening and closing a block of code. .... Happy Hunting! PipPip....Jimdandy
To add comments, please log in or register