Site menu

CodeCook.io

  • Languages
    • C
    • C++
    • CSS
    • Git
    • HTML
    • Java
    • JavaScript
    • jQuery
    • PHP
    • Python
    • Ruby
    • Scala
  • function

Scala - Function

Declaration of global or locally scoped function.

0
518
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

Define function

def {{function_name}} = {
  {{body}}
}
java

Notes

last update: Oct. 27, 2014

0
576
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

Single line function

def {{function_name}} = {{body}}
java

Notes

last update: Oct. 27, 2014

0
539
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

Define side-effecting function

def {{function_name}}(): Unit = {{body}}
java

Notes

last update: Oct. 27, 2014

0
597
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

Function as first class citizen.

val {{function_name}}: String => Unit = {
  x => {{body}}
}
java

Notes

last update: Oct. 27, 2014

Advertisement

This project is hosted on DigitalOcean, try it and support us

Related concept

  • Function default parameter
  • Apply function to list

Other language

  • JavaScript
  • Ruby

Random task

  • Random number
  • Key value key existence test
  • Check if specific commit is on remote
  • Find file by name in current subtree
  • key value list all values
  • Blog
  • About
  • License