Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1.  
  2. def foo(x, y)
  3. if x == y
  4. 1
  5. else
  6. 0
  7. end
  8. end
  9.  
  10. f = [1, 2, 3, 4, 5]
  11. g = [1, 2, 3, 4, 5]
  12.  
  13. r = 1
  14.  
  15. f.each do |i|
  16. r *= foo(f[i], g[i])
  17. end
  18.  
  19.  
  20. if r == 1
  21. puts "f and g are copies"
  22. else
  23. puts "f and g are not copies"
  24.  
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement