출처: 초보자를 위한 코틀린(Kotlin) 200제 / 엄민석 지음 | 정보문화사 | 2018년 05월 20일 출간 

비교연산자 Comparison Operator: 두 개의 피연산자를 비교하는 연산자

package com.practice017

// 비교 연산자Comparison Operator
fun main(args: Array<String>): Unit
{
	var isRight: Boolean = (10 + 70) > (3 * 25)
	println(isRight)	// 출력: true

	isRight = false
	println(isRight)	// 출력: false

	isRight = 30 == (10 + 20)
	println(isRight)	// 출력: true

	isRight = 0.00001f == 0.005f * 0.002f
	println(isRight)	// 출력: false

	isRight = 3.0 * 5 + 2.7 <= 16
	println(isRight)	// 출력: false
}

출처: 초보자를 위한 코틀린(Kotlin) 200제 / 엄민석 지음 | 정보문화사 | 2018년 05월 20일 출간

비교연산자의 결과 타입은 Boolean 이며, true(참) 과 false(거짓) 이 있다

https://kotlinlang.org/docs/reference/operator-overloading.html#comparison

 

Operator overloading - Kotlin Programming Language

 

kotlinlang.org

+ Recent posts