This tutorial explains how to run following scala program (script) from a command line in Windows 10. But when I run the following command, it gives me the error: expression expected but '.' found
scala> scala args.scala Hello World!
Remarks:
The full path of the file is C:\Test\args.scala. But even if I type the full path in the above command line, it still gives the exact same error.
The inline commands such as the following work fine:
scala> println (“Hello World”)
scala> 7 * math.Pi
Question: What I may be missing and how we can fix the issue?
Instructions from the above linked tutorial:
Open your editor, and write the following small program:
println(“Your arguments are:”)
for (i ← 0 until args.length) {
println(i + ": " + args(i))
}
Save it as a file named args.scala.
Try running this program from the command line, with arguments, such as:
The scala code runner was not very good and soon it is being replaced with scala-cli which will become the official code runner. https://scala-cli.virtuslab.org/
So I recommend using scala-cli. If you need more detailed support, drop by Discord for live chat, you can get much faster / better feedback there. Scala