Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. object GetCapital extends App {
  2. val capitals = Map("US" -> "Washington", "Germany" -> "Berlin")
  3.  
  4. if (args.length < 1) {
  5. println("You must specify a country to look for.")
  6. System.exit(1)
  7. }
  8.  
  9. val country = args(0)
  10.  
  11. if (capitals.contains(country))
  12. println("The capital of " + country + " is: " + capitals(country))
  13. else
  14. Console.err.println("The given country is not in our list")
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement