Endless Loop
- Posted by Joseph Martin <jam at EXIS.NET> Apr 21, 1997
- 858 views
Well I've done it again. I've gotten myself in a mess that only the gallant heroes of the Euphoria for DOS Mailing List can fix. Below is source for a routine I'm writing. I found out through the with trace statement that I'n an endless loop, BUT I can't figure out why. Someone PLEASE tell me where I'm misreading code. Thanks a bunch guys. with trace --test.ex include test.e sequence test, test_1 test = "Joseph Martin" trace(1) test_1 = nospace(test) printf(1, "%s", {test_1[1]}) --test.e global function nospace(sequence s1) sequence s2 atom space, n, x, y space = 1 n = 0 while space != 0 do space = find(32, s1) if space = 0 then return{s2} else n = space - 1 s2 = s1[1..n] x = space + 1 y = length(s1) s2 = s2 & s1[x..y] end if end while return{s2} end function ~~>Joseph Martin ~~>Personal: joe at cyber-wizard.com ~~>Web: jam.net at poboxes.com ~~>URL: http://users.exis.net/~jam/