right$() -- return (or change) the right end of a string
The right$-function requires two arguments (a string and a number) and returns the part from the right end of the string, whose length is specified by its second argument. So, right$ simply returns the requested number of chars from the right end of the given string.
Note, that the right$-function can be assigned to, i.e. it may appear on the left hand side of an assignment. In this way it is possible to change a part of the variable used within the right$-function. Note, that that way the length of the string cannot be changed, i.e. characters might be overwritten, but not added. For an example see below.
print "Please enter a length either in inch or centimeter"
print "please add 'in' or 'cm' to mark the unit."
input "Length: " a$
if (right$(a$,2)="in") then
elsif (right$(a$,2)="cm") then
error "Invalid input: "+a$
This program allows the user to enter a length qulified with a unit (either inch or centimeter).
The second example demonstrates the capability to assign to the right$-function.