This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Soldier(val position: Int, var state:State = State.Living) { | |
fun suicide() { | |
state = State.Dead | |
} | |
fun isAlive() = state == State.Living | |
} | |
enum class State { | |
Living, Dead | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package codestory2013.gzoritchak | |
import java.math.BigDecimal | |
import java.math.RoundingMode | |
import java.text.DecimalFormat | |
import java.text.DecimalFormatSymbols | |
import java.util.Locale | |
import java.util.StringTokenizer | |
import kotlin.math.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package codestory2013.gzoritchak.jajascript | |
class Flight(val id: String, val startHour: Int, val duration: Int, val price: Int){ | |
val endHour = startHour + duration | |
} | |
class Planning(val gain: Int = 0, val flights: List<Flight> = listOf()) { | |
fun plus(flight: Flight) = Planning(gain + flight.price, flights + flight) //Planning + Flight = Planning | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codestory2013.gzoritchak.scalaskel.Coin.* | |
import java.util.* | |
enum class Coin(val value: Int) { | |
foo : Coin(1) | |
bar : Coin(7) | |
qix : Coin(11) | |
baz : Coin(21) | |
} |
NewerOlder