Created
December 9, 2021 03:27
-
-
Save pcorliss/43ca000dc7be17e06c0bce870816ac86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):035:0> s = Set.new | |
=> #<Set: {}> | |
irb(main):036:0> a = Set.new([1,2,3]) | |
=> #<Set: {1, 2, 3}> | |
irb(main):037:0> b = Set.new([1,2,3]) | |
=> #<Set: {1, 2, 3}> | |
irb(main):038:0> s.add(a) | |
=> #<Set: {#<Set: {1, 2, 3}>}> | |
irb(main):039:0> s.include?(b) | |
=> true | |
irb(main):040:0> a.add 99 | |
=> #<Set: {1, 2, 3, 99}> | |
irb(main):041:0> s.include?(b) | |
=> false | |
irb(main):042:0> s.include?(a) | |
=> false | |
irb(main):043:0> s.add a | |
=> #<Set: {#<Set: {1, 2, 3, 99}>, #<Set: {1, 2, 3, 99}>}> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment