cinadr
(Zimmermann Zsolt)
1
Hi!
This might be a bug. I can only test in JSScripting currently. OH version is 4.0.0 release.
The code:
var a = Quantity('0.0 mm');
var b = Quantity('0.2 mm');
console.log(a);
a.add(b);
console.log(a);
a.add('0.2 mm');
console.log(a);
The result:
2023-07-26 15:31:12.585 [INFO ] [hab.automation.script.ui.testscript2] - 0 mm
2023-07-26 15:31:12.586 [INFO ] [hab.automation.script.ui.testscript2] - 0 mm
2023-07-26 15:31:12.587 [INFO ] [hab.automation.script.ui.testscript2] - 0 mm
This supposed to be 0.0, then 0.2, then 0.6 mm. Am I misunderstanding this?
Thank you.
rlkoshak
(Rich Koshak)
2
add
returns a new Quantity with the result of the operation. It doesn’t change the original value.
var a = Quantity('0.0 mm');
var b = Quantity('0.2 mm');
console.log(a);
a = a.add(b);
console.log(a);
a = a.add('0.2 mm');
console.log(a);
1 Like
cinadr
(Zimmermann Zsolt)
3
Oops, that was an easy one. Sorry for taking your time. And thank you for your help…
system
(system)
Closed
4
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.