The returned value of a switch or if statement is the value returned by the case block actually run. A block, {}, returns the value manually returned by use of the if-exitWith command, else returns the value returned by the last statement in the block, else nil. In this case, you are setting _index again to the return value from the inner hints. If the hints weren't inside the case blocks, the code actually would still work, since "{_index = 0}" returns 0, just like "{0}". This is because the command, hint, always returns nil, which is then passed back to the switch, which then overwrites the valid value of _index and leads the last hint to show a bad value.
What I think you want to do is:
private ["_index"]; // Scope _index so it will still be visible after the switch.
// No point hinting inside the cases, since the one after the switch will overwrite it.
switch (startSide) do
{
case WEST: { _index = 0 };
case EAST: { _index = 1 };
};
hint format ["%1", _index]; // --> 0 if west, 1 if east.
If you actually do want to use the returned value from the switch to set _index, however:
// Don't need to use private here, since _index is created at the same scope as the later hint.
_index = switch (startSide) do
{
case WEST: { 0 }; // This "returns" a value of 0 to the overall switch.
case EAST: { 1 }; // This "returns" a value of 1 to the overall switch.
};
hint format ["%1", _index]; // --> 0 if west, 1 if east.
I do hope that makes some sense. Either set the value in the cases (1st example), or use the cases to hand back the value to the switch itself (2nd example). Definitely don't do both at once ;P