Return Sole Element in a Set

Published by Werdna in

Given a set containing one element, return the element.

Examples

require 'set'

first = Set.new
first << 1
element_from_set(first) ➞ 1

Notes

N/A

Watch a quick demo on how Edabit works.