Skip to content

Instantly share code, notes, and snippets.

@DeepSky8
Created October 15, 2014 16:40
Show Gist options
  • Select an option

  • Save DeepSky8/c52674431caf4057ea4a to your computer and use it in GitHub Desktop.

Select an option

Save DeepSky8/c52674431caf4057ea4a to your computer and use it in GitHub Desktop.
Playing around with maps
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