2017-10-08 58 views
-2

根據Kotlin REPL中的:help,我可以通過load:命令加載文件。如何加載Kotlin中的文件REPL

>>> :help 
Available commands: 
:help     show this help 
:quit     exit the interpreter 
:dump bytecode   dump classes to terminal 
:load <file>   load script from specified file 

但加載文件失敗,像這樣。 Rational.kt存在當前目錄。

>>> load: "Rational.kt"; 
error: unexpected tokens (use ';' to separate expressions on the same line) 
load: "Rational.kt"; 

load: Rational.ktload: "Rational.kt"都沒有工作。 如何在REPL中加載文件? 我找不到它的例子。而不是``:load`

回答

0

嘗試不帶引號:

>>> :load Rational.kt

+0

你的回答讓我注意到我使用'負荷。謝謝。 – ironsand