Skip to content

Instantly share code, notes, and snippets.

@nomisRev
Last active July 10, 2017 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nomisRev/bb197be88cdfe4b9cf0a18a63e9567b5 to your computer and use it in GitHub Desktop.
Save nomisRev/bb197be88cdfe4b9cf0a18a63e9567b5 to your computer and use it in GitHub Desktop.
Modelling data in Kotlin
sealed class MathExpression
data class Add(val left: MathExpression, val right: MathExpression) : MathExpression()
data class Sub(val left: MathExpression, val right: MathExpression) : MathExpression()
data class Number(val value: Int): MathExpression()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment