How do you create integers 0..9 and math operators + - * / in to binary strings. For example:
0 = 0000, 1 = 0001, ... 9 = 1001
Is the
In ruby Integer class, to_s is defined to receive non required argument radix called base, pass 2 if you want to receive binary representation of a string.
base
Here is a link for an official documentation of String#to_s
1.upto(10).each { |n| puts n.to_s(2) }