https://kotlinlang.org logo
#announcements
Title
# announcements
p

poohbar

12/02/2017, 1:43 PM
could anyone explain what is the difference between creating a kotlin file and a kotlin class? Does a class convert into a file if I add a function outside of the class? Does a file turn into a class if I remove it later? I am confused.
k

kevinherron

12/02/2017, 1:55 PM
The only difference I can see is that a file is initially empty in your editor
c

Czar

12/02/2017, 2:18 PM
with Kotlin it's just an aesthetics and terminology thing
a

Andreas Sinz

12/02/2017, 2:57 PM
the difference is that
Kotlin file
creates a file with just the package declaration and
Kotlin class
a file with the package declaration and an empty class
p

poohbar

12/02/2017, 3:05 PM
also, if you create it as class it doesnt show the
kt
extension in
Project
window.. ever
😞
c

Czar

12/02/2017, 7:24 PM
Huh, for me it does. When I make it a "file" it shows .kt, when I remove "file" features and it becomes a class .kt disappears. At least that's what I remember, I'm on my wintendo now, so can't check.
1
2 Views