From: Ibrahim Tencer <landofdreams@...>
Date: 2012-03-12T23:52:45+09:00
Subject: [ruby-core:43247] [ruby-trunk - Bug #6132][Open] Assignments don't happen correctly in "if" modifiers


Issue #6132 has been reported by Ibrahim Tencer.

----------------------------------------
Bug #6132: Assignments don't happen correctly in "if" modifiers
https://bugs.ruby-lang.org/issues/6132

Author: Ibrahim Tencer
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.0.0]


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.


-- 
http://bugs.ruby-lang.org/