Kotlin follows Java naming conventions:
PascalCase
for type namescamelCase
for variable, function and method namesSCREAMING_CASE
for constants and enum valuesVariables and functions can be declared at:
Kotlin has the following visibility modifiers:
public
: same as C#private
: same as C#… plus can be used at file scope to limit access to this fileprotected
: same as C#internal
: similar to C# - visible to the current “module” (a set of files that are compiled together e.g. Maven/Gradle project, IntelliJ project)The default for everything is public
.
C#
class ImplicitlyInternal
{
void ImplicitlyPrivate()
{
}
}
Kotlin
class ImplicitlyPublic {
fun implicitlyPublic() {
}
}