Re: Print a sequence (Phix)
- Posted by jimcbrown (admin) in February
- 463 views
Hi,
This would be more suitable for a IRC chat, but I couldn't find any Euphoria channel.
I'm not sure that there is one since freenode imploded.
But I was expecting that the line buffer1:... would print all the sequence s, but only prints the first element.
To print a sequence, one has to make use of a for or while loop?
Am I interpreting the above instructions in a wrong way?
The message is there because strings are sequences. So the common mistake is to do something C-like,
printf(1, "%s\n", "hello world!")
and wonder why only the h was printed. It's explaining that it's one format per element, a one to one pairing that increments on both sides in parallel.
Basically you only have one %s in the printf, so it will only print out the first element of the sequence. You need one %s per element to print out multiple string values in a single printf.