Skip to content

Instantly share code, notes, and snippets.

@vitsky91
Created May 2, 2023 13:14
Show Gist options
  • Save vitsky91/9f9a01a179fa595b8f34f742942fc9b1 to your computer and use it in GitHub Desktop.
Save vitsky91/9f9a01a179fa595b8f34f742942fc9b1 to your computer and use it in GitHub Desktop.
Linked List - Swift Enums
indirect enum LinkedListNode {
case head(value: Int, node: LinkedListNode)
case node(value: Int, next: LinkedListNode)
case tail(value: Int)
}
let linkedList = LinkedListNode
.head(value: 0, node:
.node(value: 1, next:
.node(value: 2, next:
.node(value: 3, next:
.tail(value: 4)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment