Last active
December 18, 2015 22:09
-
-
Save kaeawc/5852850 to your computer and use it in GitHub Desktop.
Example of using returns in Scala inside a Play! controller action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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