Skip to content

Instantly share code, notes, and snippets.

@mchmielarz
Created March 14, 2019 22:33
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 mchmielarz/1851a4aa99599043f1f7c93d22e04907 to your computer and use it in GitHub Desktop.
Save mchmielarz/1851a4aa99599043f1f7c93d22e04907 to your computer and use it in GitHub Desktop.
for-comprehension: Building a car with Scala's for-comprehension
var car = for {
 engine <- engine()
 wheels <- wheels()
 body <- body()
} yield Car(body, engine, wheels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment