Scala Basics for a Python Dev

Best Practices
  • Camel case instead of snake e.g. addOne
  • Short temporary variables
Variables
Scala

Python

Function Parameters & Return Values
Scala

Python

Functions
Scala

Python

Anonymous Functions
Scala

Python

NOTE: Just like in python you can can assign an anon function or any function for that matter to a variable and pass the reference via that variable assignment.

Multi-Line Functions
Instead of having a tabular syntax just like in JavaScript “which is pretty hot right now”, you can wrap any of the functions contents discussed above anon or otherwise in {}.

def times_two …

Drop your email below to get updated on my next post!