Comment by oezi Comment by oezi 19 hours ago 2 replies Copy Link View on Hacker News You are right on return (use next in a block), but break uses block scope.
Copy Link judofyr 18 hours ago Collapse Comment - Maybe I explained it a bit imprecise. I was trying to explain the following behavior: def foo p 1 yield p 2 end foo { break } This only prints "1" because the break stops the execution of the invoked method (foo). Reply View | 1 reply Copy Link Mystery-Machine 15 hours ago Parent Collapse Comment - WAT? I'm a 12+ years Ruby developer and I didn't know this. Reply View | 0 replies
Copy Link Mystery-Machine 15 hours ago Parent Collapse Comment - WAT? I'm a 12+ years Ruby developer and I didn't know this. Reply View | 0 replies
Maybe I explained it a bit imprecise. I was trying to explain the following behavior:
This only prints "1" because the break stops the execution of the invoked method (foo).