Number sign Property

  • Post author:
  • Post category:Dart
  • Post comments:2 Comments
Number sign Property

In this guide, we will discuss Number sign Property. Returns minus one, zero or plus one depending on the sign and numerical value of the number.

This property returns minus one if the number is lesser than zero, plus one if the number is greater than zero and zero if the number is equal to zero.

Syntax

num.sign

Example

void main() { 
   int posNum = 10; 
   int negNum = -12;
   int valZero = 0;  
   
   print(posNum.sign); 
   print(negNum.sign); 
   print(valZero.sign); 
}  

It will produce the following output −

1 
-1 
0

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply