Yesterday, 11:04 PM
(Yesterday, 10:36 PM)Kernelpanic Wrote:(Yesterday, 09:28 PM)RhoSigma Wrote:Thanks to a740g and RhoSigma for the effort. @RhoSigma, it works!(Yesterday, 09:14 PM)a740g Wrote: I am guessing from the image that you want to get the max of 3 numbers.
Code: (Select All)maxOfThree = _IIF(a > b, _IIF(a > c, a, c), _IIF(b > c, b, c))
Less writing:
Code: (Select All)maxOfThree = _MAX(_MAX(a, b), c)
I love this kind of thing: simple and clear! Thanks!
Code: (Select All)
'Tenaeren Operator in QB64 ab Vers. 4.0 - 16. Dez. 2024
'Dank an a740g und RhoSigma - 17. Dez 2024
Option _Explicit
Dim As Long zahl1, zahl2, zahl3, max
Locate 3, 3
Print "Dreifach tenaerer Operator in QB64"
Locate 4, 3
Print "=================================="
Locate 6, 3
Input "Zahl 1: ", zahl1
Locate 7, 3
Input "Zahl 2: ", zahl2
Locate 8, 3
Input "Zahl 3: ", zahl3
max = _Max(_Max(zahl1, zahl2), zahl3)
Locate 10, 3
Print Using "Die groesste Zahl ist: ####"; max
End
Yes, but to be exact, that's a double _MAX function, not a triple tenary operator anymore. Although, the _MAX function uses the tenary _IIF internally, so from that point of view it makes not much differnce.
GuiTools, Blankers & other Projects:
https://qb64phoenix.com/forum/forumdisplay.php?fid=32
Libraries & useful Functions:
https://qb64phoenix.com/forum/forumdisplay.php?fid=23
https://qb64phoenix.com/forum/forumdisplay.php?fid=32
Libraries & useful Functions:
https://qb64phoenix.com/forum/forumdisplay.php?fid=23