I am learning rails and following this thread. I am stuck with the to_proc method. I consider symbols only as alternatives to strings (they are like strings but cheaper in terms of memory). If there is anything else I …
I want to store a "code block" in a variable to be reused, something like:
block = do
|test| puts test
end
3.upto(8) block
Can someone show me what am I doing so obviously wrong? (Or if it's just impossible)
I am having a lot of trouble understanding how return works in blocks, procs, and lambdas.
For instance, in the following case, why does batman_ironman_proc work, while batman_yield throw an error?
def batman_ironman_proc
victor = Proc.…