Changes between Version 10 and Version 11 of RubyLanguage
- Timestamp:
- 05/05/10 12:21:34 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RubyLanguage
v10 v11 71 71 72 72 Notice that in Cobra, the first argument is the name of the program being called, while in Ruby it's the first parameter. 73 So, if we were to run the Cobra class above: 74 75 {{{ 76 cobra.exe a.cobra -run-args one two three 73 If you were to run the Ruby script like this: 74 75 {{{ 76 ruby a.rb one two three 77 }}} 78 79 You would see this as the output: 80 81 {{{ 82 one 83 two 84 three 85 }}} 86 87 If we were to run the Cobra class above: 88 89 {{{ 90 cobra.exe a.cobra -- one two three 77 91 }}} 78 92 … … 85 99 }}} 86 100 87 If you were to run the Ruby script like this: 88 89 {{{ 90 ruby a.rb one two three 91 }}} 92 93 You would see this as the output: 94 95 {{{ 96 one 97 two 98 three 101 But you can use slicing to bypass the program name: 102 {{{ 103 #!python 104 class A 105 def main is shared 106 for argument in CobraCore.commandLineArgs[1:] 107 print argument 99 108 }}} 100 109