If we had integers I can compare them like so
let a = 12 < 21
I seem to missunderstand how to perform comparison for floats as the code below gives me an error
let b = 1.22 <. 2.11
How is comparison done for floats ?
If we had integers I can compare them like so
let a = 12 < 21
I seem to missunderstand how to perform comparison for floats as the code below gives me an error
let b = 1.22 <. 2.11
How is comparison done for floats ?
Comparison operators are polymorphic in OCaml/ReasonML, so you can do let b = 1.22 < 2.11;
The general type of all comparison operators is 'a => 'a => bool
, that means you can compare any two values for equality or inequality as long as they have the same type. See https://reasonml.github.io/api/Pervasives.html#6_Comparisons for details.