I'm trying to reverse an integer in F#. I have the following approach:
//let the number be n
rev = 0
while(n != 0){
rev = rev * 10 + n % 10;
n /= 10;
}
// rev now contains the reverse integer of n
I'm new to F#, and I don't know the the idiomatic syntax to achieve this implementation. I don't want to reverse the number by converting it to string first. How can this implementation be done in F# in an idiomatic way?