Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iampushpinder/6a0fa14731f86c98615f81d8893b3185 to your computer and use it in GitHub Desktop.
Save iampushpinder/6a0fa14731f86c98615f81d8893b3185 to your computer and use it in GitHub Desktop.
/** associate without labels */
enum Trade {
case Buy(String, Int)
case Sell(String, Int)
}
Trade.Buy("Firstbank PLC", 300)
Trade.Sell("Firstbank PLC", 700)
/** associate with labels */
enum Trade {
case Buy(stock: String, amount: Int)
case Sell(stock: String, amount: Int)
}
Trade.Buy(stock: "Firstbank PLC", amount: 300)
Trade.Sell(stock: "Firstbank PLC", amount: 700)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment