- Code: Select all
# Conversion ºC to ºF
celsiusVar = indigo.variables[123456789]
tempVar = celsiusVar.getValue(float)
indigo.variable.updateValue(987654321,str(tempVar * 9/5 + 32))
Sometimes the result might be xx.xx (2 decimal places), and sometimes it might be something like this (xx.xxxxxxxxx) both from the same code.
I would like to see examples of how this code can be written to control decimals as follows:
No decimal (xx)
1 decimal (xx.x)
2 decimals (xx.xx)
Also, do I need a “default=xx” after float? .getValue(float, default=xx)