Project

General

Profile

Actions

Bug #6132

closed

Assignments don't happen correctly in "if" modifiers

Added by ibrahimtencer (Ibrahim Tencer) over 10 years ago. Updated over 10 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.0.0]
Backport:
[ruby-core:43247]

Description

This works:

if lo = 3
la = lo
end

but this does not:

(la = lo) if (lo = 3)

It raises "NameError: undefined local variable or method `lo' for main:Object." But if you look at the values afterwards you get lo -> 3, la -> nil.


Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Feature #8600: Recognize variables declared in if modifier at end of lineRejected07/04/2013Actions
Actions

Also available in: Atom PDF