Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. [1,2,3,4,5].each do |e| #do starts the block
  2. puts e
  3. end #end ends it
  4.  
  5. $.each([1,2,3,4,5], function(e) { //Anonymous *function* starts here
  6. console.log(e);
  7. }); //Ends here
  8.  
  9. class Array
  10. def my_each
  11. i = 0
  12. while(i<self.length)
  13. yield self[i]
  14. i+=1
  15. end
  16. end
  17. end
  18.  
  19. def foo(&block)
  20. end
  21.  
  22. def Proc.new(&block)
  23. block
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement