Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Comparison Operators | Boolean Expressions and Logical Conditions
Control Flow in Kotlin

bookComparison Operators

メニューを表示するにはスワイプしてください

Comparison Operators in Kotlin

Comparison operators let you check how two values relate to each other. In Kotlin, you use operators like ==, !=, >, <, >=, and <= to compare numbers, strings, or other data types. These operators always return a Boolean result — either true or false — depending on whether the comparison is correct.

  • Use == to check if two values are equal;
  • Use != to check if two values are not equal;
  • Use > to check if one value is greater than another;
  • Use < to check if one value is less than another;
  • Use >= to check if one value is greater than or equal to another;
  • Use <= to check if one value is less than or equal to another.

You use these operators in everyday programming to make decisions, filter data, or control the flow of your code. By understanding how comparison operators work, you can write code that responds differently based on the values being compared.

Main.kt

Main.kt

copy
question mark

Which operator checks if two values are equal in Kotlin?

正しい答えを選んでください

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 1.  2

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 1.  2
some-alt