At 08:05 PM 6/30/97 +0200, you wrote: >Hi folks, > >I want to remove from a word the first and last letter every time I call a >recursive function. >So ... MSWLOGO > SWLOG > WLO > L > >I write the following procedure > >to remove :wrd >if emptyp :wrd [stop] >print :wrd >remove bf bl :wrd >end > >When the procedure gets to the last letter (L), I get a error message >" .... Logo doesn't like [] as an input for bf .... ". >I understand the error. But how do I fix it? > >Regards, >Harrie >H.Hoenjet@inter.NL.net Harrie, Just say: to remove :wrd if 2>count :wrd [stop] print :wrd remove bf bl :wrd end Reason: MSWLOGO consists of an ODD number of letters. When eventually you remain with a single letter, you can't ask for the BF BL :WRD of it, as it becomes empty after BL :WRD, and Logo can't go on and perform the BF of an empty word. Your program works perfectly with a word of an even number of letters. Regards... [[Yehuda]] --------------------------------------------------------------- Please post messages to the Logo forum to logo-l@gsn.org. Mail questions about the list administration to logofdn@gsn.org. To unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home