Skip to content

Instantly share code, notes, and snippets.

@IvanBond
Created December 4, 2016 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save IvanBond/c61e5fdbd617e339f383664401b5204c to your computer and use it in GitHub Desktop.
Save IvanBond/c61e5fdbd617e339f383664401b5204c to your computer and use it in GitHub Desktop.
(num as number, optional string as nullable text) =>
let
input_string = if string = null then "" else string,
reminder = Number.Mod( num, 2 ),
resulting_string = Text.From( reminder ) & input_string,
input = Number.IntegerDivide( num, 2 ),
r = if input > 0 then
@fNumberToBinaryString( input , resulting_string)
else resulting_string
in
r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment