Jump to content

Binary digits: Difference between revisions

(Added Crystal translation of Ruby version.)
Line 1,171:
=={{header|Crystal}}==
{{trans|Ruby}}
Using an array
<lang ruby>[5,50,9000].each do |n|
puts "%b" % n
end</lang>
Using a tuple
or
<lang ruby>[{5,50,9000]}.each { |n| puts n.to_s(2) }</lang>
Output:
<pre>101
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.