Project

General

Profile

Actions

Feature #6561

closed

?= operator

Added by slayer (Vlad Moskovets) over 12 years ago. Updated about 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
[ruby-core:45518]

Description

I have feature proposition to add new opearator ?= its like ||= but assigns only when variable is not defined
So it should be shortcut for

@var ?= 1

eq

defined?(@var) ? @var : @var = 1

It should useful for caching nil'able or false'able items


Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Feature #6023: Add "a ?= 2" support for meaning "a = a.nil? ? 2 : a"Rejectedmatz (Yukihiro Matsumoto)02/15/2012Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0