簡體   English   中英

如何在 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.ktload: "Rational.kt"都不工作。 如何在 REPL 中加載文件? 我找不到它的例子。

嘗試不使用引號:

>>> :load Rational.kt

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM