package iii_conventions.multiAssignemnt

import util.TODO
import util.doc30

fun todoTask30(): Nothing = TODO(
    """
        Task 30.
        Read about destructuring declarations and make the following code compile by adding one word (after uncommenting it).
    """,
    documentation = doc30()
)

class MyDate(val year: Int, val month: Int, val dayOfMonth: Int)

operator fun MyDate.component1() = year
operator fun MyDate.component2() = month
operator fun MyDate.component3() = dayOfMonth

fun isLeapDay(date: MyDate): Boolean {
    val (year, month, dayOfMonth) = date

    // 29 February of a leap year
    return year % 4 == 0 && month == 2 && dayOfMonth == 29
}
package iii_conventions.multiAssignemnt

import util.TODO
import util.doc30

fun todoTask30(): Nothing = TODO(
    """
        Task 30.
        Read about destructuring declarations and make the following code compile by adding one word (after uncommenting it).
    """,
    documentation = doc30()
)

data class MyDate(val year: Int, val month: Int, val dayOfMonth: Int)

//operator fun MyDate.component1() = year
//operator fun MyDate.component2() = month
//operator fun MyDate.component3() = dayOfMonth

fun isLeapDay(date: MyDate): Boolean {
    val (year, month, dayOfMonth) = date

    // 29 February of a leap year
    return year % 4 == 0 && month == 2 && dayOfMonth == 29
}
Complete koan 30, take 2 (Destructuring Declarations). Instructions say to only add one word, in this case "data" to class
Complete koan 30, take 2 (Destructuring Declarations). Instructions say to only add one word, in this case "data" to class

sleberknight/kotlin-koans,sleberknight/kotlin-koans