Max$: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
  MAX$(A1$,A2$,...,AN$)
  MAX$(A1$,A2$,...)


The '''Max$''' [[internal function]] returns the largest string value in the set of strings inside parentheses (A1$, A2$ and so on). When comparing strings, the largest value is the one with the highest ASCII value. If only letters of the alphabet are being compared, MAX$ will return the string that is last in alphabetical order.
The '''Max$''' [[internal function]] returns the largest string value in the set of strings inside parentheses (A1$, A2$ and so on). When comparing strings, the largest value is the one with the highest ASCII value. If only letters of the alphabet are being compared, MAX$ will return the string that is last in alphabetical order.

Revision as of 01:56, 6 June 2013

MAX$(A1$,A2$,...)

The Max$ internal function returns the largest string value in the set of strings inside parentheses (A1$, A2$ and so on). When comparing strings, the largest value is the one with the highest ASCII value. If only letters of the alphabet are being compared, MAX$ will return the string that is last in alphabetical order.

Comments and Examples

10 LET str1$ = "B"
20 LET str2$ = "N"
30 LET str3$ = "T"
40 PRINT MAX$(str1$, str2$, str3$)

The above program will print the string "T" (without the quotation marks).


10 LET A$ = "red"
20 LET B$ = "green"
30 LET C$ = "blue"
40 PRINT MAX$(A$,B$,C$)

The above program will print the string "red" (without the quotation marks).

Related Functions

MAX is a similar function for numbers. Similarly, MIN$ and MIN return the smallest values.

Technical Considerations

  1. The number of items that can be listed inside the parenthesis is limited only by the maximum line length of 800 characters in source code or 255 characters in compiled code.
  2. The COLLATE option in effect when the program was last saved or in the OPTION statement can alter the string comparisons within the MAX$ function.