Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
array[index,length] strange behaviour
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Rob Biedenharn, post: 4670372"] Well, given that Matz is a C programmer (as was I), he may have wanted to allow: <code lang="ruby"> arr = [ 0, 1, 2, 3, ] </code> When making C array literals, I would often do: <code lang="C"> int arr[] = { 0 ,1 ,2 ,3 }; </code> because it was much more likely to add another element to the end than to the beginning of the array. In C, you couldn't have a trailing comma and in ruby, there has to be something to clue the parser into the fact that there's more to come on the next line. -Rob Rob Biedenharn [email]Rob@AgileConsultingLLC.com[/email] [URL]http://AgileConsultingLLC.com/[/URL] [email]rab@GaslightSoftware.com[/email] [URL]http://GaslightSoftware.com/[/URL] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
array[index,length] strange behaviour
Top