From: "Abinoam Jr." Date: 2010-12-22T12:18:23+09:00 Subject: Re: Someone explain to me the logic behind ARGV[0] --0016e6434aac824ab10497f73402 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Just in case it's not clear enough for him (Kaye ng)... In C argv[0] is the name of file being executed and argv[1] is the actual "first" argument. In Ruby ARGV[0] is like argv[1] in C, the actual first argument. Play around a bit with a script like this. p ARGV ARGV.each_with_index do |x,y| puts "#{y} - #{x}" end Abinoam Jr. On Tue, Dec 21, 2010 at 7:45 PM, Alec Ross wrote= : > This naming and usage stems back to the C programming language. There, ar= gv > is the conventional name for any command line arguments to the program, a= nd > it denotes an array of c-style strings. =A0Elements of an array in C are > accessed by a (0-based) index. =A0Hence argv[0] gets the first argument v= alue, > argv[1] the second, and so on. > > HTH, > > Alec > -- > Alec Ross --0016e6434aac824ab10497f73402 Content-Type: application/x-ruby; name="argv.rb" Content-Disposition: attachment; filename="argv.rb" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ghznk3i00 IyEvdXNyL2Jpbi9lbnYgcnVieQoKaWYgQVJHVi5sZW5ndGggPT0gMAogIHB1dHMgIlVzYWdlOiBh cmd2IDxhcmd1bWVudHM+IiAKICBleGl0CmVuZCAgCgpwIEFSR1YKQVJHVi5lYWNoX3dpdGhfaW5k ZXggZG8gfHgseXwgCiAgcHV0cyAiI3t5fSAtICN7eH0iCmVuZAogCgo= --0016e6434aac824ab10497f73402--