Project

General

Profile

Misc #15431

Hashes and arrays should not require commas to seperate values when using new lines

Added by nsuchy (Nathaniel Suchy) over 1 year ago. Updated over 1 year ago.

Status:
Open
Priority:
Normal
Assignee:
-
[ruby-core:90597]

Description

Ruby should not require commas for hash and array values if using new lines. I think the syntax would look cleaner without.

Example

myHash = {
  :key => “value”,
  :anotherKey => “another value”
}

Could be

myHash = {
  :key => “value”
  :anotherKey => “another value”
}

And

myArray = [
  1,
  2,
  3
]

Could be:

myArray = [
  1
  2
  3
]

The syntax looks a bit cleaner, with the new lines is there a need to require a comma? I look forward to hearing the community’s thoughts on this idea :)


Related issues

Is duplicate of CommonRuby - Feature #10528: Allow line breaks instead of commas in arrays, hashes, argument lists, etc.OpenActions

Also available in: Atom PDF