如何在 Kotlin REPL 中加载文件
How to load a file in Kotlin REPL
根据 Kotlin REPL 中的 :help
,我可以通过 load:
命令加载文件。
>>> :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.kt
和 load: "Rational.kt"
都不行。
如何在 REPL 中加载文件?
我找不到它的例子。
不加引号试试:
>>> :load Rational.kt
根据 Kotlin REPL 中的 :help
,我可以通过 load:
命令加载文件。
>>> :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.kt
和 load: "Rational.kt"
都不行。
如何在 REPL 中加载文件?
我找不到它的例子。
不加引号试试:
>>> :load Rational.kt