Created
August 27, 2018 17:08
-
-
Save edwingustafson/326cc3fe522362c209153534314a3a41 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
val middleInitial: Option[Char] = Some('Q'); | |
val result: String = middleInitial match { | |
case Some(c) => s" ${c}." | |
case None => "" | |
} | |
println(s"John${result} Public"); | |
// yields "John Q. Public" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment