# Value Change Sensitivity

**URL:** <https://www.ruby-forum.com/t/value-change-sensitivity/141743>\
**Category:** Rails\
**Created:** [June 30, 2008, 9:49am UTC](https://www.ruby-forum.com/t/value-change-sensitivity/141743 "2008-06-30T09:49:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shenley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@shenley](https://www.ruby-forum.com/u/shenley)\
**Post date:** [June 30, 2008, 9:49am UTC](https://www.ruby-forum.com/t/value-change-sensitivity/141743/1 "2008-06-30T09:49:48Z")

</div>

How do I do something like this :

i = 0  
a = Thread.new {  
i.valueChange { | val | puts "i is now #{val} }  
}  
b = Thread.new {  
i = 2 # =\> “i is now 2”  
}  
a.join  
b.join

The idea is everytime the value of i changes, the block associated  
with i gets executed
