Dart编程实例 - 相等和关系操作符

本文为大家分享 Dart编程实例 - 相等和关系操作符 的具体示例代码,提供大家参考,具体内容如下:

void main() {
   var num1 = 5;
   var num2 = 9;
   var res = num1>num2;
   print('num1 greater than num2 ::  ' +res.toString());
   res = num1<num2;
   print('num1 lesser than  num2 ::  ' +res.toString());
   res = num1 >= num2;
   print('num1 greater than or equal to num2 ::  ' +res.toString());
   res = num1 <= num2;
   print('num1 lesser than or equal to num2  ::  ' +res.toString());
   res = num1 != num2;
   print('num1 not equal to num2 ::  ' +res.toString());
   res = num1 == num2;
   print('num1 equal to num2 ::  ' +res.toString());
}

下一章:Dart编程实例 - 类型测试操作符 is

本文为大家分享 Dart编程实例 - 类型测试操作符 is 的具体示例代码,提供大家参考,具体内容如下:void main() { int n = 2; print(n is int);} ...