Ruby Algorithm — valid ISBN10

  • If the index of the number is equal to 9 (as it will be the last one) and is the digit is “X” to make the assignment to the number variable the value of 10.
  • If the digit is any other number to assign the output with a false value. Otherwise to add to the total variable the number, converted to an integer and multiplied by its index + 1.

Conclusion

--

--

--

Full Stack Web Developer | antonzaharia.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Kotlin for Interviews series

Big O notation and time complexity part 6

Smaller & Faster Code Review with Stacked Merge Request

Hot reload or hot restart — Flutter

🥳New staking pool will be introduced on the $WSG platform which will hold the highest value for…

Remix in VSCode: Compiling, debugging, Metamask & Remixd

Lean vs Agile: Or Is Butter Different from Margarine?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Zaharia Anton

Zaharia Anton

Full Stack Web Developer | antonzaharia.com

More from Medium

Backtracking Using Recursion

Require function in Node.js

Binary Tree Traversal Without Recursion

Finding the Articulation Points OR Cut Vertices in a Graph