#COMPILE EXE "s99_palindrome.exe"
' Sample: Palindrome checker
FUNCTION IsPalindrome(BYVAL s AS STRING) AS LONG
    DIM i AS LONG, n AS LONG
    n = LEN(s)
    FOR i = 1 TO n \ 2
        IF MID$(s, i, 1) <> MID$(s, n - i + 1, 1) THEN
            FUNCTION = 0
            EXIT FUNCTION
        END IF
    NEXT i
    FUNCTION = 1
END FUNCTION
FUNCTION PBMAIN() AS LONG
    PRINT "Palindrome test results:"
    IF IsPalindrome("radar") THEN PRINT "  radar - YES" ELSE PRINT "  radar - NO"
    IF IsPalindrome("hello") THEN PRINT "  hello - YES" ELSE PRINT "  hello - NO"
    IF IsPalindrome("racecar") THEN PRINT "  racecar - YES" ELSE PRINT "  racecar - NO"
    FUNCTION = 0
END FUNCTION
