Extended KotD #23 and #24: _MIN and _MAX - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Official Links (https://qb64phoenix.com/forum/forumdisplay.php?fid=16) +--- Forum: Learning Resources and Archives (https://qb64phoenix.com/forum/forumdisplay.php?fid=13) +---- Forum: Keyword of the Day! (https://qb64phoenix.com/forum/forumdisplay.php?fid=49) +---- Thread: Extended KotD #23 and #24: _MIN and _MAX (/showthread.php?tid=3383) |
Extended KotD #23 and #24: _MIN and _MAX - SMcNeill - 01-16-2025 Two more really simple commands thich were added in version 4.0 for us, and which I'll cover here together as they both work exactly the same way: _MIN and _MAX. The syntax for these are as simple as: value = _MIN(num1, num2) value = _MAX(num1, num2) And, what these do for us is tell us which is the smallest (minimum) number and which is the largest (maximum) value. Code: (Select All)
The above would print: Quote: 123 Another useful application could be to find the minimum and maximum values in a numeric array: Code: (Select All)
That's all there is to these two commands as well. They're simple, straightforward functions which nobody should have any real issues implementing and using. They really don't need much explanation as a KotD, except to help draw awareness so folks will realize they're in the language now and there for you to use if/when you need them. _MIN returns the lesser of two numbers, _MAX returns the greater of two numbers. What more needs be said about them? |