개발 언어 (Language)/Kotlin
코틀린 구문
Tarake
2024. 7. 28. 11:01
코틀린의 구문
코틀린에서 fun은 함수를 선언하는데 사용됩니다.
코틀린에서 main()은 함수를 실행하는데 사용됩니다.
코틀린에서의 출력
fun main() {
print("Hello World")
println("HelloWorld")
}
코틀린에서 출력은 다른 언어와 마찬가지로 print() 함수를 사용하고 만약 실행 후 줄바꿈을 하고 싶다면 println() 함수를 사용하면 됩니다.
코틀린에서의 주석 처리
코틀린의 주석은 단일 줄 주석과 다중 줄 주석이 있습니다.
단일 줄 주석 처리 방식
fun main() {
println("hello") // 단일줄 주석 처리 입니다.
}
다중 줄 주석 처리 방식
fun main() {
/*
println("hello world)
이것도
주석 처리
됩니다.
*/
}
주석처리는 자바와 마찬가지로 // 또는 /* */ 방식으로 주석처리하면 됩니다.
출처
W3Schools.com
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
Basic syntax | Kotlin
kotlinlang.org