object scala {
// def looper(x : Long, y : Long) : Long = {
// var a = x
// var b = y
// while(a != 0){
// val temp = a
// a = b % a
// b = temp
// }
// b
// }
// println(looper(100,298))
// def dowhile(){ //dowhile循环
// var line = ""
// do {
// println("Please input some wrds blow.....")
// line = readLine()
// println("Read: " + line)
// } while (line != "" ) //定义一个变量line为空值,然后输入一个line值。打印出read+line,当line等于空值的结束循环,反之一直循环下去。
// }
def main(args: Array[String]){
// var file = "scala.txt"
// if (!args.isEmpty) file =args(0)
//val file = if(!args.isEmpty) args(0) else "Spark.xml"
// println(file) //定义一个变量file 当没有传进参数的时候就输出scala.txt 当传进args值时就打印传进的值
//println(if(!args.isEmpty) args(0) else "Spark.xml")
// println("This is Spark!!!")
//}
//dowhile
//for (i <- 1 to 10) {
// println("Number is :" + i) //打印1到10
//}
//val files = (new java.io.File(".")).listFiles()
//for (file <- files){
// println(file)
//} //打印当前文件夹下面的所有文件
val n = 99
// val file = "Spark.txt"
// openFile(file)
try{
val half = if (n % 2 == 0) n /2 else throw
new RuntimeException("N must be event")
// Use the file
}catch{
case e : Exception => println("The exception is :" + e.getMessage)
}finally{
// close(file)
}
}
}