Re: Stupid Newbie-sounding question.
- Posted by irv mullins <irvm at ellijay.com> May 29, 2004
- 552 views
Michelle wrote: > but the problem with that is that it prints "John" as a string of the ascii > codes, > instead of an easily editable "John".. > if i add if sequence() it counts "John" as a sequence, just like the > sequence of > flags.. > so my question is... > how i can (within a loop) tell it to evaluate whether to puts or print? > > bah..told you it was a stupid newbie question > > Michelle Rogers > Not stupid at all. What the Eu docs call "flexible", I call a design flaw. Euphoria cannot tell the difference between "John" and {74,111,104,110} where the latter might be a series of integers or flags or whatever. The easy way is to not try to write a universal "print" function which has to somehow detect how things are supposed to be printed, but just use printf(.. with the appropriate params to print the entire sequence at one time. Use \n as appropriate to break it up into lines. If your flags are always either 0 or 1, (which aren't printable characters), you might look for 0 or 1 in every sequence, and if found, consider this to be a sequence of flags, otherwise print as a string. Irv.