Last active
January 8, 2017 10:09
-
-
Save ababup1192/9cce8a1a70d8d53e00126f133b30b7f6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
object Main extends App { | |
def myif(p: => Boolean)(thenS: => Any)(elseS: => Any): Any = { | |
var res: Any = null | |
val result = p && { res = thenS; true} || { res = elseS; false} | |
res | |
} | |
def myelse(elseS: => Any): Any = { | |
elseS | |
} | |
println(myif(1 != 1){ | |
"aaaaa" | |
}( myelse { | |
"bbbbb" | |
})) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
else
つけてもつけなくてもOKだしAnyにならない版です