Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala REPL: error: ';' expected but string literal found

Tags:

scala

What is wrong with this simple text book REPL?

C:\Users\abc>scala
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_45).
Type in expressions to have them evaluated.
Type :help for more information.

scala> print "Hello"
<console>:1: error: ';' expected but string literal found.
       print "Hello"
             ^

scala>

This is supposed to print "Hello"

like image 576
Aravind Yarram Avatar asked Nov 28 '22 02:11

Aravind Yarram


1 Answers

It does work if you ask nicely:

scala> object please {
     |   val print = Predef.print _
     | }
defined module please

scala> please print "Hello"
Hello
like image 162
Jasper-M Avatar answered Feb 27 '23 12:02

Jasper-M