Created
September 18, 2012 03:55
-
-
Save gom/3741153 to your computer and use it in GitHub Desktop.
BEGIN END Control Structures difference in Ruby 1.8.7 and 1.9.3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby -v | |
ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-darwin11.3.0] | |
$ seq 1 10 | ruby -ne 'BEGIN{ a=0 }; a += $_.to_i; END{ puts a }' | |
-e:1: undefined method `+' for nil:NilClass (NoMethodError) | |
$ ruby -v | |
ruby 1.9.3p135 (2012-02-21 revision 34718) [x86_64-darwin11.2.0] | |
$ seq 1 10 | ruby -ne 'BEGIN{ a=0 }; a += $_.to_i; END{ puts a }' | |
55 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment