Model Objects Using Data Classes | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/7910496-programming-in-kotlin-fundamentals/lessons/45

just wanted to note that in the line where it reads:

“val filip = Person(name = “Filip”, lastName = “Babic”, age = 23, dog)”

when I run the project, i get an error message in the last item, and I fixed it by doing this:

“val filip = Person(name = “Filip”, lastName = “Babic”, age = 23, pet = dog)”

Maybe it’s just a difference with the Intellij version, but will just leave this here in case someone had the same issue (in the video it can be seen that Filip just writes “dog” and the code runs smoothly).

Hey @claudiom24!

Nice catch! It could also be the Kotlin version we’re using, as well as the IntelliJ version.

Kotlin usually asks of you to list out all the parameter names up until the last one, when using named parameters. However, I think it should also know if you have only one parameter left, and if you used the parameters in order in the class, which one you’re referring to last!

Thanks!

1 Like

Thank you for your reply. Good job with this course! I liked it

1 Like

@claudiom24 Really glad you liked it! Cheers! :]