Skip to content
Snippets Groups Projects
Commit 8ed4d8e5 authored by reeplay's avatar reeplay
Browse files

add more contents to AboutKotlin_2

parent 824cb3a6
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,7 @@ fun main(){
**downTo 함수**
**downTo <u>함수</u>**
감소되는 연속된 값 범위 생성한다.
......@@ -66,7 +66,7 @@ fun main(){
**until 함수 **
**until <u>함수</u> **
끝값이 정확히 지정되지 않을 때 사용된다. until로 지정된 범위의 상한값은 제외시킨 범위를 생선한다.
......@@ -87,7 +87,25 @@ fun main(){
#### 기타
#### 2. when 표현식
when 표현식은 <u>괄호 안에 있는 인자</u>(argument)와 <u>중괄호 안에서 지정 지정한 조건값</u>들을 기준으로 == 비교 연산자로 두 값을 각각 비교한다.
```kotlin
fun main(){
val healthStatus = when(healthPoints){
100 //-> "최상의 상태"
in 50..99 //-> "약간의 찰과상 존재"
else -> "최악의 상태"
}
println(userName + " " + healthStatus)
}
```
*드 해석: →(화살표)의 왼쪽부분이 healthPoints 변수의 값이 될 수 있는 범위를 나타낸다. 즉, **in 키워드**를 통해서 healthPoints가 해당 범위에 속하는지 검사한다.*
#### 3. 기타
* 비교연산자
......@@ -151,5 +169,23 @@ fun main(){
* 문자열 템플릿(string template)
'**$ + 변수**'로 작성하여 문자열 안에 변수의 값을 포함시켜 출력할 수 있다.
```kotlin
fun main(){
val userName = "Joylish"
var healthPoints = 10
println("$name의 건강점수는 $healthPoints이다.")
}
```
**(+a) 문자 표현식**
문자열 내부에서 '**$ + 중괄호'**를 활용해서 중괄호 안에 있는 표현식을 실행한 후 그 결과를 문자열에 삽입한다.
![TextExpression](./captures/TextExpression.png)
documents/captures/TextExpression.png

12.3 KiB

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c8fe5052-ef54-4670-996b-63e6701eba50" name="Default Changelist" comment="" />
<list default="true" id="c8fe5052-ef54-4670-996b-63e6701eba50" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../../documents/AboutKotlin_2.md" beforeDir="false" afterPath="$PROJECT_DIR$/../../documents/AboutKotlin_2.md" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
......@@ -81,6 +83,7 @@
</panes>
</component>
<component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="configurable.group.appearance" />
</component>
......@@ -131,7 +134,6 @@
</component>
<component name="ToolWindowManager">
<frame x="762" y="0" width="781" height="830" extended-state="0" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.18307906" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment