You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,6 +186,16 @@ println("Hello from Kotlin with 5g of heap memory running in server mode!")
186
186
```
187
187
188
188
189
+
### Scripts with a main method do not run with `kscript`?
190
+
191
+
There is [no need](https://kotlinlang.org/docs/tutorials/command-line.html#using-the-command-line-to-run-scripts) for a main method in a Kotlin script. Kotlin kts scripts can be more simplistic compared regular kotlin `*.kt` source files and work without a main method by directly running the provided code. E.g.
192
+
```
193
+
print("hello kotlin!")
194
+
```
195
+
is a valid Kotlin `kts` script.
196
+
197
+
Regular class files are not supported [yet](https://github.com/holgerbrandl/kscript/issues/31#issuecomment-309976103) by `kscript`. This is because a `kt` Kotlin source file might contain multiple classes with a main method in each, so the entry point might not be always clearly defined. (see #31)
0 commit comments