Skip to content

Instantly share code, notes, and snippets.

@thluiz
Last active December 12, 2016 15:11
Show Gist options
  • Save thluiz/452ae30bdd9a47627ba238bfa4b07c33 to your computer and use it in GitHub Desktop.
Save thluiz/452ae30bdd9a47627ba238bfa4b07c33 to your computer and use it in GitHub Desktop.
Convert a UInt32 (Unsigned Integer) to Binary in F#
let rec to_binary(value: UInt32)=
if value < 2u then
value.ToString()
else
let divisor = value/2u
let remainder = (value % 2u).ToString()
to_binary(divisor) + remainder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment