g$="happy halloween my fellow programmers " REPEAT h$=FNnxtwrd(g$) IF h$<>"" THEN PRINT h$ UNTIL h$="" END DEFFNnxtwrd(c$) PRIVATE cnt% LOCAL ret$ cnt%=cnt%+1 WHILE MID$(c$,cnt%,1)<>" " ret$=ret$+MID$(c$,cnt%,1) cnt%=cnt%+1 ENDWHILE IF ret$="" THEN cnt%=0 =ret$
g$="happy halloween my fellow programmers!!! * " REPEAT PRINT FNgetword(g$) UNTIL g$="" END DEF FNgetword(RETURN z$) LOCAL J%, b$ J%=INSTR(z$,CHR$32) :REM Find the next space IF J% THEN b$=LEFT$(z$,J%-1) :z$=MID$(z$,J%+1) :REM Slice off next value from string. ELSE =FNtrim(z$) :REM No space so must be last field in record. ENDIF =FNtrim(b$) DEF FNtrim(a$) REM trim any punctuation here as needed. =a$