Cannot Put Floats into Map (has workaround)
I have found that to put a float into a map I have to assign it to a variable and then concatenate it with an empty string, otherwise it goes in as null.
Other developers may be interested to know that I found this while debugging a problem using <string>.toDecimal() to get the float back - it was choking on the null, and I didn't realise where the null came from until I resorted to mapping out the map contents.
string demoCannotPutFloatIntoMap()
{
theMap = map();
theMap.put("int", 1);
theMap.put("float", 6.6);
theMap.put("string", "6.6");
// theMap.put("compile failure", 6.6+""); //Must put in variable before can do this!
intVar = 2;
floatVar = 6.6;
theMap.put("intVar", intVar);
theMap.put("floatVar", floatVar);
theMap.put("floatStr", floatVar + "");
return (((((((((("Results: int - " + theMap.get("int")) + " - float - ") + theMap.get("float")) + " - string - ") + theMap.get("string"))
+ "\n - intVar - ") + theMap.get("intVar")) + " - floatVar - ") + theMap.get("floatVar") + " - floatStr - ") + theMap.get("floatStr"));
}