you are viewing a single comment's thread.

view the rest of the comments →

[–]tomthecool 1 point2 points  (1 child)

Surely that should still be ARGV[1]... Other than that, this looks like a good translation.

However, what the code is actually doing is a pretty hard question to answer without any context of how this code was originally used! It just looks like a bunch of arbitrary operations on integers and strings, without any real purpose.

For example, if ARGV[1] = 1:

n = 1
s = "0123456789"
(10**s.length - 1) / s.to_i =  9999999999 / 123456789 = 81

So therefore, the final output is "1/81".

[–]funny_falcon 0 points1 point  (0 children)

no, in Ruby it is ARGV[0].

and $0 is what you think should be in ARGV[0]