11-02-2022, 01:55 AM
For those that are not sure how it works.
The minutes and seconds are essentially the same. So, I'll only explain the Boolean algebra portion.
m <= 9 and m > 9 are mutually exclusive comparisons, that will return a 0 or a -1 and a -1 or 0, respectively .
The negative outside the parenthesis flips the the sign to positive.
48 is the ASCII character for '0' and 35 is the ASCII character for '#'
So, depending on the value of 'm' being greater or less than 9, you will get the value 48 or 35
And you plug that into your string.
Code: (Select All)
tmp = Chr$((48 * -(m <= 9)) + (35 * -(m > 9))) + "#:" + Chr$((48 * -(s <= 9)) + (35 * -(s > 9))) + "#"
The minutes and seconds are essentially the same. So, I'll only explain the Boolean algebra portion.
Code: (Select All)
Chr$(48 * -(m <= 9)) + (35 * -(m > 9))
m <= 9 and m > 9 are mutually exclusive comparisons, that will return a 0 or a -1 and a -1 or 0, respectively .
Code: (Select All)
Chr$((48 * -(-1)) + (35 * -(0)))
or
Chr$((48 * -(0)) + (35 * -(-1)))
The negative outside the parenthesis flips the the sign to positive.
Code: (Select All)
Chr$((48 * 1) + (35 * 0))
or
Chr$((48 * 0) + (35 * 1))
48 is the ASCII character for '0' and 35 is the ASCII character for '#'
So, depending on the value of 'm' being greater or less than 9, you will get the value 48 or 35
Code: (Select All)
Chr$(48) '0
or
Chr$(35) '#
And you plug that into your string.