Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Practice: Classes and Collections: Android Basics with Compose - Task 7 #122

Open
Akronix opened this issue Aug 4, 2024 · 0 comments
Open

Comments

@Akronix
Copy link

Akronix commented Aug 4, 2024

If I use the solution for task 7:

val Event.durationOfEvent: String
                	get() = if (this.durationInMinutes < 60) {"short"} else {"long"}

I get:
Unresolved reference 'durationOfEvent'.
when calling to println("Duration of first event of the day: ${events[0].durationOfEvent}").

However, if I remove the Event. part in the extension property (so it's an extension of the objects and not of a class property),

val durationOfEvent: String
                	get() = if (this.durationInMinutes < 60) {"short"} else {"long"}

now it works correctly:
Duration of first event of the day: short

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant