Binary conversion app I'm pretty new to ruby and programming in general.

I had an idea for a fun little project that I could use to gain a little experience. I wrote a simple program that takes a 4 bit binary sequence (ie. 1001, 1110, etc) and converts it into its decimal counterpart (ie 1111 = 15). I got the program working but even I can tell it's pretty ugly and limited code. I've been racking my brain trying to figure out a way to improve and I'm thinking if I do something similar to this app (converting to an array and reversing so i can work left to right instead of right to left) but instead of hard coding the if statements for each digit I could use a loop that just doubles the last digit and add that to the sum if it's a one in that spot. 

#!/usr/bin/ruby
# binary_conversion.rb


puts "
    ***************************************************
            BINARY CONVERSION TOOL
                VERSION: 0.1
            CREATED BY: Micky Scandal
    ***************************************************
"
sleep(1)
again = 0
while again != "n"
    @zero = 0
    @one = 0
    @two = 0
    @three = 0
    @bin_input = ""
    until @bin_input.length == 4                                    # &amp;&amp; bin_input.class == Fixnum
        print "Please enter a 4 bit binary string (ex: 0110):&gt; "
        @bin_input = gets.chomp
    end
    puts "You entered #{@bin_input}"

    @bin_array = @bin_input.to_s.split(//).map(&amp;:to_i)
    @bin_array.reverse!
    p @bin_array
    puts "converting..."; sleep(0.5)

    if @bin_array[0] == 1
        @zero = 1
    end
    if @bin_array[1] == 1
        @one = 2
    end
    if @bin_array[2] == 1
        @two = 4
    end
    if @bin_array[3] == 1
        @three = 8
    end

    ans = @zero + @one + @two + @three
    puts "answer is #{ans}"
    puts ""
    puts "Run again? (Y/N)"
    again = gets.chomp
end
Welcome to SO and glad you are learning Ruby.
You know there are easy ways in Ruby to do convertions between numbers ?
If not take a look at this blog http://rubyquicktips.com/post/18935873770/convert-between-number-bases-easily

Answering your question: you have a lot of boiler code which you could cut by taking the exponent of each digit like here under. While I still could do this shorter by injecting an object instead of declaring the dec = 0 I won't do so for readability.

I use the method each_char on the string to split into a character array and daisychain this result to another method with_index that adds... yes an index.
Then I use the formula below to add the exponent of that char multiplied by 2 (the base) converted to an integer taking into account the position in the string.
This is not the best algorithm by far to do this, just an example how to use these methods to shorten your code and make it more 'Rubylike'.
If you search for good exercises which you can test and compare your results with others solutions taka a look at https://www.codewars.com

Happy code learning !

bin_input = "1111"
puts bin_input.to_i(2)  #=&gt; 15 this is the normal Ruby way

# This is our educational way
dec = 0
print dec
bin_input.to_s.each_char.with_index do |char, index|
  dec += (char.to_i*2)**(bin_input.length-(index+1))
  puts "+(#{char.to_i*2})**(#{bin_input.length-(index+1)})"
end
puts dec # 15


Which gives

15
0+(2)**(3)
+(2)**(2)
+(2)**(1)
+(2)**(0)
15