无涯教程-Dart - isNegative函数

39 阅读1分钟

如果数字为负数,则此属性返回true。

isNegative - 语法

num.isNegative 

isNegative - 示例

void main() { 
   int posNum=10; 
   int negNum=-10; 

print(posNum.isNegative); print(negNum.isNegative); }

它将产生以下输出-

false 
true

参考链接

www.learnfk.com/dart-progra…