There are two general strategies:
1.you can write a script file and use the interpreter
2. you can compile an object that has a main method.
To make a script file, simply put Scala code into a file and make the file executable. and to use a main method, you must include in your Scala code an object with a main method. The main method should have the same type signature as in Java, namely:
def main(args: Array[String]): Unit
Once you have such an object, you can already run it using the scala program. To make your program more convenient, you can write a shell script file that invokes scala the correct way, thus making your program appear like any other program on the platform.