<eucode>Re: Append

new topic     » goto parent     » topic index » view thread      » older message » newer message
	object pc = { {{},{}} }    -- pc is a sequence of sequences which contains two sequences 
	pc[1][1] = "1234"   
	pc[1][2] = "2345"  
-- prints 2  
	puts(1,"len pc = " & to_string(length(pc)) & "\n")  
	for x = 1 to length(pc) do   
		for y = 1 to 2 do  
-- prints 1234, then 2345  
			puts(1, to_string(pc[x][y]) & "\n")  
		end for  
	end for  
	pc = append(pc,pc[1])  
-- print 3; i thought it would be 2  
	puts(1,"len pc after append = " & to_string(length(pc)) & "\n")  
	pc[2][1] = "3456"   
	pc[2][2] = "4567"  
	for x = 1 to length(pc) do  
		for y = 1 to 2 do  
-- prints 1,2 then 3456,4567, then 1234, 2345  
-- I had planned on it printing 1234, 2345 then 3456, 4567  
			puts(1,pc[x][y] & "\n")  
		end for  
	end for  
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu