当前位置: 首页 > 文档资料 > Dart 中文教程 >

isNegative

优质
小牛编辑
116浏览
2023-12-01

如果数字是负数,则此属性返回布尔值true。

语法 (Syntax)

num.isNegative 

例子 (Example)

void main() { 
   int posNum = 10; 
   int negNum = -10; 
   print(posNum.isNegative); 
   print(negNum.isNegative); 
} 

它将产生以下output -

false 
true