Swtich statements and doubles

 

Pre build 600 (which I have on one trading station), the switch statement allowed expression types of doubles. However, now as of build 600, it appears doubles are no longer allowed to be expression types? Is this a bug, or is this the new and improved MQL code feature that breaks old code? Seems kinda limiting if I'm using doubles, then I have to either build a bloated if then else statement, or come up with a dictionary of double values mapped to valid switch expression types that can then be used in the switch statement.

 

When using the switch operator, the expression of the switch operator "must be of integer type." The build 600+ behavior is consistent with build 509 and earlier. See the Book.

Note to MQL4.com Admins:

This is one of those instances where having the documentation for build 509 and earlier, in addition to the documentation for build 600+, on the forum for reference would be helpful. There are those of us that still may, on occasion, need to refer back to the older version of the documentation (for build 509 and earlier) to support legacy code and to lend support to those on this forum. I ask that you reconsider your decision to completely remove the older version of the documentation (for build 509 and earlier).

 
dangerboybb: Pre build 600 (which I have on one trading station), the switch statement allowed expression types of doubles.
The pre 600 documentation said:

It compares the expression value with constants in all variants of case and gives control to the operator that corresponds with the expression value. Each variant of the case can be marked with an integer or literal constant or with a constant expression. The constant expression cannot contain variables or function calls. Expression of the switch operator must be of integer type.

switch(expression)
  {
   case constant: operators
   case constant: operators
     ...
   default: operators
  }
The post 600 documentation says:
   switch ( Expression )                           // Operator header 
      {                                          // Opening brace
      case Constant: Operators                   // One of the 'case' variations 
      case Constant: Operators                   // One of the 'case' variations 
      ...
      [default: Operators]                        // Variation without any parameter
      }                                         // Closing brace

The values of Expression and of Parameters can only be the values of int type. The Expression can be a constant, a variable, a function call, or an expression. Each variation 'case' can be marked by an integer constant, a character constant, or a constant expression. A constant expression cannot include variables or function calls.

Reason: