Skip to content

Instantly share code, notes, and snippets.

@kaeawc
Last active December 18, 2015 22:09
Show Gist options
  • Save kaeawc/5852850 to your computer and use it in GitHub Desktop.
Save kaeawc/5852850 to your computer and use it in GitHub Desktop.
Example of using returns in Scala inside a Play! controller action
package controllers
import play.api._
import play.api.mvc._
object Application extends Controller {
def doStuff:Result = {
if (1 != 1) return InternalServerError("Whoa shit")
if(a == "b") return BadRequest("A should never equal B")
return Ok("LOL HI")
}
def index:EssentialAction = {
Action {
doStuff
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment