# What are the challenges?

Small programming tasks that requires you to implement a function or a class in Kotlin. Thanks to them you can check in practice if you understand material correctly and train it to be able to use it immediately after the workshop. All challenges are verified by unit tests.

# Exemplary challenges

```// Fibonacci number that starts from 1 and 1 (fib(0) == 1, fib(1) == 1, fib(2) == 2, fib(3) == 3, fib(4) == 5, fib(5) == 8) // https://en.wikipedia.org/wiki/Fibonacci_number fun fib(n: Int): Int = TODO() fun main() { fib(0) shouldEquals 1 fib(1) shouldEquals 1 fib(2) shouldEquals 2 fib(3) shouldEquals 3 fib(4) shouldEquals 5 fib(5) shouldEquals 8 fib(6) shouldEquals 13 fib(7) shouldEquals 21 fib(8) shouldEquals 34 fib(9) shouldEquals 55 fib(10) shouldEquals 89 } infix fun <T> T.shouldEquals(other: T) { if (this != other) throw AssertionError("Value \$this not equal to \$other") }```
```interface Person { val name: String val age: Int val canBuyAlcohol: Boolean fun helloText(): String fun cheerText(person: Person): String } // TODO: Implement classes Businessman and Student // * They both should implement Person // * They both can buy alcohol only if over 21 // * Businessman says hello by “Good morning”, Student by “Hi”. // * Businessman cheers by “Hello, my name is {his name}, nice to see you {cheered person name}”, Student by “Hey {cheered person name}, I am {his name}”. fun main() { val businessman: Person = TODO("Use Businessman constructor here once it is implemented") val student: Person = TODO("Use Businessman constructor here once it is implemented") println(businessman.helloText()) println(student.helloText()) println(businessman.cheerText(student)) println(student.cheerText(businessman)) fun sayIfCanBuyAlcohol(person: Person) { val modal = if(person.canBuyAlcohol) "can" else "can't" println("\\${person.name} \$modal buy alcohol") } sayIfCanBuyAlcohol(businessman) sayIfCanBuyAlcohol(student) }```

## Mariusz Saramak

### Tom Tom

On this workshop, I not only systematized knowledge about Kotlin syntax but also, thanks to Marcin, I changed my way of thinking about problem-solving to functional way - I got a new tool that I can use at work on a daily basis. It seems to me that whole training is focused on immediate use of new knowledge in daily work. Big +

## Patryk Grajewski

### Sii Poland

Very good workshop. Perfect for developers that want to move easily from Java to Kotlin. During the workshop, we did plenty of exercises that enabled checking new knowledge in practice.