Skip to content

Instantly share code, notes, and snippets.

@ifalok007
Created July 29, 2022 06: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 ifalok007/892dbae098b9c005666a9cdf9aa06557 to your computer and use it in GitHub Desktop.
Save ifalok007/892dbae098b9c005666a9cdf9aa06557 to your computer and use it in GitHub Desktop.
medium scala notes
object IdFactory {
  private var counter = 0
  def create(): Int = {
  counter += 1
  counter
}
}
val newId: Int = IdFactory.create()// YOU ACCESS OBJECTS BY ITS NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment