I am running Scala 2.9.2 REPL and if I copy&paste following method:
def isPrime(num: Int): Boolean = {
val ceiling = math.sqrt(num.toDouble).toInt
(2 to ceiling) forall (x => num % x != 0)
}
..from the file with a source code (where it works well) to the Interactive Interpreter. I get this exception:
java.lang.IllegalArgumentException: != 0): event not found
at jline.console.ConsoleReader.expandEvents(ConsoleReader.java:426)
...
The problem is the !
character (methods without exclamation mark works well).
Is there any way to make the method work in the REPL?