Skip to content Skip to sidebar Skip to footer

First Letter Of Variable's Name Is Changing From Uppercase To Lowercase

I created an iOS app that stores the data to Firebase realtime database like this: users - ID -- Email: 'test@domain.com' -- UsersName: 'test' -- Level: 1 -- XP: 0 Now I started

Solution 1:

Kotlin works on JVM (Java Virtual Machine), so in order to be able to run a .kt file, first of all it should be compiled into a Java file. So when using a class that looks like:

dataclassUser(var UsersName: String = "",
            var XP: Int = 0,
            var Level: Int = 1,
            var Email: String = "")

The corresponding Java file is created and according to the Java Naming Conventions regading variables:

It should be a lowercase letter such as java, lang.

This means that doesn't matter if you choose the name of your fields to start either with an uppercase or a lowercase, all fiels are converted to start with a lowercase. That's why the properties in your database are present like that. Not only in Java/Kotlin is this convention available but also in other programming languages, so I recommend you to use this recommendation in your projects.

Regarding Kotlin, remember that at the end, everything is converted to byte code so it can work on JVM.

Post a Comment for "First Letter Of Variable's Name Is Changing From Uppercase To Lowercase"