Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions 이펙티브 코틀린/effectivekotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.5.10"
application
}

group = "me.user"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
}

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")

testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

application {
mainClass.set("MainKt")
}
1 change: 1 addition & 0 deletions 이펙티브 코틀린/effectivekotlin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kotlin.code.style=official
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
185 changes: 185 additions & 0 deletions 이펙티브 코틀린/effectivekotlin/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions 이펙티브 코틀린/effectivekotlin/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions 이펙티브 코틀린/effectivekotlin/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

rootProject.name = "effectivekotlin"

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fun main(args: Array<String>) {
println("Hello World!")

// Try adding program arguments via Run/Debug configuration.
// Learn more about running applications: https://www.jetbrains.com/help/idea/running-applications.html.
println("Program arguments: ${args.joinToString()}")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package chapter1.item1

class BankAccount {
var balance = 0.0
private set

fun deposit(depositAmount: Double) {
balance += depositAmount
}

fun withdraw(withdrawAmount: Double) {
if (balance < withdrawAmount) {
throw InsufficientFunds()
}
balance -= withdrawAmount
}
}

class InsufficientFunds: Exception()

fun main() {
val account = BankAccount()
println(account.balance)
account.deposit(100.0)
println(account.balance)
account.withdraw(50.0)
println(account.balance)
}

Loading