original source : https://www.youtube.com/playlist?list=PLlxmoA0rQ-LwgK1JsnMsakYNACYGa1cjR

image

var 는 변수 , val은 상수 설정한다.

var의 경우 data type을 정해주거나 기본값을 설정함으로써 암시적으로 data type을 결정해야 한다.

image

==========================================================

.

.

.

class , function

image

==========================================================

.

.

.

string interpolation

image

==========================================================

.

.

.

package , import

아래와 같이 두 화일이 다른 package에 있는데 이쪽화일에서 저쪽 화일의 내용을 사용해야 하는 경우 아래와 같이 import를 사용한다.

class Person(var name: String)은 기본 contructor 기능을 수행하며 name property를 만든다.

image
image

==========================================================

.

.

.

data type

image
image

==========================================================

.

.

.

data type

image

==========================================================

.

.

.

string interpolation

image
image

==========================================================

.

.

.

range 

image
image

==========================================================

.

.

.

if statement, if expression

image
image

==========================================================

.

.

.

where statement, where expression

image
image
image

==========================================================

.

.

.

Loops, iterator, Loop statement

image
image
image

==========================================================

.

.

.

image
image

==========================================================

.

.

.

image
image

==========================================================

.

.

.

break statement

image
image
image
image

==========================================================

.

.

.

continue statement

image
image
image
image

==========================================================

.

.

.

function

image
image

==========================================================

.

.

.

function as expression

image

==========================================================

.

.

.

interoperability

image
image

==========================================================

.

.

.

image
image

==========================================================

.

.

.

kotlin 화일명에 kt를 붙인 것이 보통 class 이름으로 사용되는데 이를 변경하고자 하는 경우 아래 방법을 이용한다.

image
image

==========================================================

.

.

.

kotlin 화일과 java 화일이 각각 다른 package에 있는 경우 import를 이용한다.

image
image

==========================================================

.

.

.

default fuction and @JvmOverloads

image
image
image

==========================================================

.

.

.

named parameter

==========================================================

.

.

.

Comments are closed.

Post Navigation