Comments (3)
The suggested solution for the 'comparison' task contains the version with 'when'. I've updated the extra examples as well (on http://try.kotlinlang.org/, the educational plugin will be updated later). This solution is already used in the koans version for IDE.
from kotlin-koans.
This solution is already used in the koans version for IDE.
Well, I've the latest version of IDEA Community with kotlin-edu plugin and I must confess that hadn't that solution until I changed it manually.
I checked the online version and you're right there is an update:
data class MyDate(val year: Int, val month: Int, val dayOfMonth: Int) : Comparable<MyDate> {
override fun compareTo(other: MyDate) = when {
year != other.year -> year - other.year
month != other.month -> month - other.month
else -> dayOfMonth - other.dayOfMonth
}
}
Thanks for response.
from kotlin-koans.
Yes, the version with the kotlin-edu plugin is the slowest in terms of the update time. By "koans version for IDE" I meant this project (https://github.com/Kotlin/kotlin-koans) which can be used without the plugin, just in IDE. But please feel free to use whatever version you like, there're almost no differences between the tasks (the kotlin-edu plugin will be updated soon as well).
from kotlin-koans.
Related Issues (20)
- Html builder(todoTask39) link to documentation HOT 1
- N25ComparisonKtTest not testing proper comaprison
- Shows tasks compilation errors, when it's not HOT 1
- Compilation Failed HOT 15
- ./gradlew test - ArrayIndexOutOfBoundsException: 450 HOT 1
- Conventions : For loop - task fails to run on https://try.kotlinlang.org HOT 2
- Task 21: Partition Task
- Not quite perfect answer in "Object expressions" and "SAM conversions" online koans
- Missing iii_conventions/_29_Tips.kt?
- Debug Breakpoints
- Upgrade to latest Gradle release version HOT 2
- Unable to save plugin settings (Android Studio 3.1.4) HOT 1
- Task 32 java.lang.NoSuchMethodError: when we have Int property
- [online] Kotlin Koans 5/42 contains incorrect assertion
- Bug in Collections/Compound tasks? HOT 10
- commenting.
- Build via Gradle Kotlin DSL
- Migrate to JUnit 5 HOT 1
- Use plugins edutools HOT 4
- Android apk
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin-koans.