kotlin エラー「error: unexpected tokens (use ‘;’ to separate expressions on the same line)」の解決方法

kotlinで、エラー「error: unexpected tokens (use ‘;’ to separate expressions on the same line)」の解決方法を記述してます。全角の空白が入っている場合などに発生します。
環境
- OS windows11 home
- java 17.0.2
- kotlin 1.6.10-release-923
エラー全文
以下のコードで発生。
fun main() {
println(1 + 2)
}
エラーメッセージ
error: unexpected tokens (use ';' to separate expressions on the same line)
println(1 + 2)
^
原因
全角の空白が入っているため

対処法
全角の空白を消して、実行する
fun main() {
println(1 + 2);
}
-
前の記事
sqlite コマンドでクエリの出力結果を変更する 2023.03.28
-
次の記事
コマンドプロンプト Administratorのログインを許可する 2023.03.28
コメントを書く