Try it Yourself: Why does yielding to put does not generate a new line?


I expected the below code to generate the following output:

method talking

Why does yielding back to the block did not apply the new line of the puts from the block and returned this instead:

method talkingdog

def double(x)
print "method talking"
yield x

double(4) {puts "dog"}


Puts adds a newline character after, not before


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.