A very simple and easy command to understand for day number 3 -- SGN.
What is SGN: It's simply the command to determine what sign a number has before it. Is it positive, negative, or 0?
When would we ever use such a command: Anytime we only need to know whether a value is less than, equal to, or greater than 0.
Example to showcase the command:
Honestly, I don't know what more to say about this command as what it does for us is so simple to understand. Negative numbers return a value of -1. Positive numbers return a value of +1, and zero, of course, returns a value of 0 as it has no sign.
What is SGN: It's simply the command to determine what sign a number has before it. Is it positive, negative, or 0?
When would we ever use such a command: Anytime we only need to know whether a value is less than, equal to, or greater than 0.
Example to showcase the command:
Code: (Select All)
For i = -10 To 10
Print i, Sgn(i)
Next
Honestly, I don't know what more to say about this command as what it does for us is so simple to understand. Negative numbers return a value of -1. Positive numbers return a value of +1, and zero, of course, returns a value of 0 as it has no sign.