Skip to content

Instantly share code, notes, and snippets.

@julioterra
Created October 9, 2011 02:12
Show Gist options
  • Select an option

  • Save julioterra/1273192 to your computer and use it in GitHub Desktop.

Select an option

Save julioterra/1273192 to your computer and use it in GitHub Desktop.
IO output methods: print and printf
num = 31
print "dec: ", num, " hex: ", num.to_s(16), " bin: ", num.to_s(2), "\n"
printf "dec: %d hex: %x bin: %08b\n", num, num, num
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment