Skip to content

Commit 34f5db9

Browse files
committed
add example of indirect case (don't know why I didn't commit this long ago)
1 parent 2c2eab1 commit 34f5db9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bk1ch04p142valueTypesAndReferenceTypes/bk1ch04p142valueTypesAndReferenceTypes/ViewController.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,14 @@ struct RecursiveDog { // compile error
4444

4545
*/
4646

47+
// but this is now legal:
4748

48-
49+
enum Node {
50+
case None(Int)
51+
indirect case Left(Int, Node)
52+
indirect case Right(Int, Node)
53+
indirect case Both(Int, Node, Node)
54+
}
4955

5056
class ViewController: UIViewController {
5157

0 commit comments

Comments
 (0)