Created
October 15, 2014 16:40
-
-
Save DeepSky8/c52674431caf4057ea4a to your computer and use it in GitHub Desktop.
Playing around with maps
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
| import java.io.{BufferedReader, InputStreamReader} | |
| import scala.collection.mutable.Map | |
| object Main { | |
| def main(args: Array[String]) { | |
| println("Welcome. What key shall we use?") | |
| val key = readLine() | |
| //val key2 = key + \n | |
| println("And what shall it unlock?") | |
| val unlock = readLine() | |
| val treasureMap = Map[String, String]() | |
| treasureMap += (key -> unlock) | |
| treasureMap += ("Second" -> "Find big X on ground.\n") | |
| treasureMap += ("Third" -> "Dig.\n") | |
| //println(treasureMap(key)) | |
| println("What key do you want to use?") | |
| val use = readLine() | |
| treasureMap(use) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment