Nov 16, 2008

I Moved this blog

I move into WordPress from Blogger.

Protean [Henggen-Zizhai]

Nov 14, 2008

Difference between "do end" and "{ }" in Ruby

"{ }" has a stronger connection than "do end".


def foobar a, b
if block_given?
yield a, b
else
puts a * b
end
end



foobar is called with block.


foobar 2, 3 do |a, b|
puts a + b #=> 5
end



b is called with block.


def b
yield
end

foobar 2, b { 3 } #=> 6

Nov 13, 2008

Birthday Party

Today is my niece's birthday.
We're going to meet her.

Nov 12, 2008

Great Help of Vim

Type ":help!" when you get panick.