z
?
z = ->(x){ x*x }[4]
@fn
al final de la ejecución?
def tutu(p) @fn = 3; p[] end fn = -> {@fn = 88 } tutu(fn) fn[]
class Array def each!(code) self.each_with_index do |n,i| self[i] = code[n] end end end puts [1,2,3].each!(lambda { |n| n+1 })
[15] pry(main)> { 2+3 }
def tutu z = proc { return } z.call puts "In a_method" end tutu()Véase 13.5.5
def tutu z = lambda { return } z.call puts "In a_method" end tutu()
v
definida en la línea 1 al final del programa?
v = 34 # linea 1 def tutu yield 3.14159 end tutu { |v| puts v }
Casiano Rodriguez León 2015-01-07