Structs in Kotlin
Go’s structs are typed collections of fields. They’re useful for grouping data together to form records.
This person
struct type has name
and age
fields:
To run the Kotlin code, simply use kotlinc
to compile the code, followed by kotlin
to execute it:
Now that we can run and build basic Kotlin programs, let’s learn more about the language.