Selasa, 11 Januari 2011

IF Scala

$ cat script.sh
#!/bin/sh
exec scala "$0" "$@"
!#

if ( args.length != 1 ) {
println("Usage: script.sh [Who]")
exit
}
println("Thanks, " + args(0) + "!")

val aList = List(1,2,3)
aList.foreach( a => println(a) )



$ ./script.sh John
Thanks, John!
1
2
3


$ ./script.sh
Usage: script.sh [Who]

Tidak ada komentar:

Poskan Komentar