Arc Forumnew | comments | leaders | submitlogin
2 points by jsgrahamus 4590 days ago | link | parent

If the string X = the string Y, print 0 (to indicate there are no differences / MUMPS uses 1-based indexing of strings)

Otherwise, go through each character of the strings and at the point where they differ, print that index and quit looping.

MUMPS does not error out on attempting to extract a character beyond the string's length. So in that event, 1 string's extract will return the empty string, which will differ from the other string's extract and will cause you to print the index and quit. Not generating such an error, of course, cuts down on the code needed.