Hey I was working on adding some tests to my projects and would really like to be able to utilize the
do block! How do I set up a method to accept the do block?
The following code has the exact same behaviour in Imba 1.5.2 and Imba v2 on scrimba:
class Dog def bark "bark!" let dog = Dog.new let result1 = dog.bark do console.log("doesn't print") let result = [1,2,3].map do console.log("prints") <-- I want to make my method work like tihs
prints prints prints
The fact that .map do works suggests that this should be possible, I just am having trouble guessing the correct syntax! In ruby I would add
yield in the methods block and once the yield was reached it would execute the passed do block.
Thanks in advance for the help!