- Index
- »
- xeto
- »
- func:choiceOf
def
func:choiceOf
choiceOf(instance, choice, checked: true)
Given a choice spec, return the most specific choice subtype implemented by the instance. If the instance implements zero or more than one subtype of the choice, then return null or raise an exception based on the checked flag. The instance may be anything accepted by the toRec()
function.
Example:
choiceOf({discharge, duct}, DuctSection) >> DischargeDuct choiceOf({hot, water}, Fluid) >> HotWater