Skip to content

Ports - Heather#36

Open
piffer59 wants to merge 2 commits intoAda-C11:masterfrom
piffer59:master
Open

Ports - Heather#36
piffer59 wants to merge 2 commits intoAda-C11:masterfrom
piffer59:master

Conversation

@piffer59
Copy link

Binary and Decimal

Congratulations! You're submitting your assignment.

@bonara
Copy link

bonara commented Mar 4, 2019

Nice work! I see we used the same logic :)
For the times loop, I don't think we need the iteration variable 'digit'. The following code should also work.

binary_array.length.times do 
    expected_decimal += binary_array[x] * 2 ** y
    x -= 1
    y += 1
  end

Since the iteration variable 'digit' starts at 0 and is incremented by 1 on each pass through the loop, we don't need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants