- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Snippet: Match Arguments
Created by admin on 2008-07-24.
Updated: 2008-07-24, 22:39
/** Basic command line parsing. */ object Main { var verbose = false def main(args: Array[String]) { for (a <- args) a match { case "-h" | "-help" => println("Usage: scala Main [-help|-verbose]") case "-v" | "-verbose" => verbose = true case x => println("Unknown option: '" + x + "'") } if (verbose) println("How are you today?") } }