I am observing an interesting behavior. I have an existing project in which I created a folder and created a Scala
script in that folder. To run it I did
- Write a Scala script, e.g. MyScript.scala
- In the menu select: Run -> Edit Configurations... Press the "+" (⌘N also works on the Mac in this dialog) Select "Scala Script" Then select your Script file in this dialog
Interestingly, if the script is the following then I get error Scala script not found
object HelloWorld{
def main(args:Array[String]): Unit ={
println("hello world");
}
}
but if the script is
def greetings(): Unit ={
println("hello")
}
greetings();
then it works!
Why IntelliJ
cannot run the 1st version of the script?