Re: String sequence characters and appending clarity

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

I know this is basic but I just need a little clarity on strings. My basic understanding was a string is simply a sequence. Given that, why cant I use append to concatenate two strings?

sequence s, ss 
s = "Hello " 
 
s &= "Fred"     --ok 
puts(1,s) 
 
ss = append(s, " Flintstone") --not ok, sequence found inside character string 
 
puts(1,ss) 

Append adds the second parameter as an element to the end of the first parameter, so you'd have:

s = { 'F', 'r', 'e', 'd', " Flinstone"} 

For this operation, you need to use the concatenation operator, '&'.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu