Sgn
Result = Sgn(Value#)
 
Parameters:

    Value# = The value you wish to query
Returns:

    Result = The value representing the sign (-1 =neg, 0= zero, 1= positive)
 

      The Sgn functions returns number value representing the sign of the queried value.


FACTS:

      * Sgn returns a -1 for negative values, 0 for zero and 1 for positive values.






Mini Tutorial:



  
  
  // create a for/loop that will loop between
  // -5 to 5
  For lp=-5 To 5
     // Display the sign of this value
     Print Sgn(lp)
  Next
  
  // show the screen and wait for a key press
  Sync
  WaitKey
  




This example would output.

  
  -1
  -1
  -1
  -1
  -1
  0
  1
  1
  1
  1
  1
  

 
Related Info: Comparisons | EVEN | Neg | ODD | Operators :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com