Ruby proper_subset?() method

In ruby programming language proper_subset?() method are return true if the set is a proper superset of the given set.

Syntax
proper_subset?(set)
Aliased as: <

Example of proper_subset?() method

# proper_subset example
require "set"

a = Set[1,7,2,4,9]
b = Set[1,2]
c = Set[1,2,3]

# Test example
t1 = b.proper_subset?(a)
t2 = c.proper_subset?(a)
t3 = b.proper_subset?(c)

# Display result
puts t1
puts t2
puts t3
true
false
true

Same as

require "set"

a = Set[1,7,2,4,9]
b = Set[1,2]
c = Set[1,2,3]

# Test example
t1 = b < a
t2 = c < a
t3 = b < c

# Display result
puts t1
puts t2
puts t3
true
false
true


Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2021, kalkicode.com, All rights reserved