switch(string_variable)
Posted: 18 Feb 2012, 15:18
				
				The NXC guide has this statement "NXC also supports using string types in the switch expression and constant strings in case labels."  However, I get "Error: Math Factor expected" when I used it that way:
			Code: Select all
string sRead;
    switch(sRead)
    {
        case "ft":
            Convert = 12 * 25.4;
            break;
        case "in":
            Convert = 25.4;
            break;
        case "cm":
            Convert = 10;
            break;
        case "mm":
            Convert = 1;
            break;
        default:
            TextOut(0, LCD_LINE3, "Bad input file",DRAW_OPT_CLEAR_WHOLE_SCREEN);
            Wait(10000);
            Stop(true);
    }