Re: Print a sequence (Phix)

new topic     » goto parent     » topic index » view thread      » older message » newer message
petelomax said...
lib9 said...

formats in fmt are applied to successive elements.

You've only got one format, and it is applying that to the first element of args. You're just missing some {}.

sequence s = {"line 1", "line 2", "line 3", "line 4"} 
printf(1, "s: %V\n", {s})   -- extra parenthesis 
sequence buffer = {}  
for i = 1 to length(s) do  
        printf(1, "l: %s\n", s[i])  
        buffer = append(buffer, s[i])  
end for  
  
printf(1, "buffer1: %v\n", {buffer}) -- {} and %s->%v 
printf(1, "buffer2: %t\n\n", string(buffer)) -- print a bool 

Thank you very much, Pete. I though that s and buffer were already declared as sequences so it wasn't needed to use the pair of braces in the printf statement.

Regarding Discord, I don't use as they ask for a phone number for identification and I don't want to give them that.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu