# this is like the cross ref example in class-decls, but the return types are nilable class Test def main is shared assert Letter.fromNumber(Number(1)).value=='a' assert Number.fromLetter(Letter('b')).value==2 class Letter var _value as String cue init(value as String) base.init _value = value get value from _value def fromNumber(n as Number) as Letter? is shared branch n.value on 1, return Letter('a') on 2, return Letter('b') return nil class Number var _value as int cue init(value as int) base.init _value = value get value from _value def fromLetter(le as Letter) as Number? is shared branch le.value on 'a', return Number(1) on 'b', return Number(2) return nil