Actions
Feature #12076
closedThe 'ditto' operator
Status:
Rejected
Assignee:
-
Target version:
-
Description
I like to introduce and propose an idea to use a 'ditto' operator in 'else' or 'elsif' statement,
the ditto operator is a reference to the true statement in the if conditions to be used in the proceeding else and elsif statements,
the goal is to reuse the true statement for other conditions also it will make the code to be much readable than recopying and pasting the true statement again.
if user == "foo"
puts "welcome" + user # => welcome foo
elsif user == "bar"
ditto # => welcome bar
else
user = "stranger"
ditto # => welcome stranger
end
Actions
Like0
Like0Like0Like0