Skip to content

Error when trying :load file in REPL (scala) - "unindent expected, but eof found" #15808

Closed
@calculusbearmudriyjo

Description

@calculusbearmudriyjo

I try load file in scala REPL (scala console tool)
by command

:load src/main/scala/Main.scala

and have error with loading (see below)

Compiler version

Scala version 3.1.3 and reproduce on 3.1.2

Minimized code

@main def hello: Unit = 
  fizzBuzz


def fizzBuzz: Unit = 
  for
    i <- 1 to 100
  do
    val x = if i % 5 == 0 then "Fizz"
      else if i % 3 == 0 then "Buzz"
      else if i % 5 == 0 && i % 3 == 0 then "FizzBuzz"
      else i
    println(x)

Output

-- [E040] Syntax Error: --------------------------------------------------------
13 |    println(x)
   |              ^
   |              unindent expected, but eof found

Expectation

load module to repl without error

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions