Hi, I want to convert from Nat to Int. How do I do this?
I assume you are asking about Motoko.
Nat is a subtype of
Int, so you don’t even have to explicitly convert – you can just use any value or expression of type
Nat in places where an
Int is expected.
In motoko, How to convert Int to Nat ?
let currentTime : Int = Time.now(); As the currentTime return Int type and we can assign the time to Nat variable or convert Int to Nat
You can use
Int.abs() from the base library.