Hi there, new joiner here (and beginner coder)
I need some help I have a project that needs a control table. This control table has 3 cols (A, B, & C) and its length (number of columns) is determined at run time, when the table is created. Col A is also populated when the table gets created, Cols B & C are initially null, and their entries are changed as the code progresses. I hope his makes sense!
I was implementing this in Scratch as 3 separate lists using the index to tie it all together, but it became really complicated when needing to read, add, change a row. Then I read about “list of Lists” in Snap.
I am stuck on: How do I create a the table, 3 by X when I don’t know the X? Also when a 3 by 10 table has been created at run time, how do change a single entry in the table , for example in the 2nd col?
Any help to point me in the right direction would really be appreciated
Wait, if the three columns are the same length, are their contents related? I mean, does the fifth thing in column A go with the fifth thing in column B and the fifth thing in column C? If so, I wouldn't make a list of columns at all. I'd make a list of rows! Then you can add a new entry with
I thought I'd update the post (for others) Both versions work, see test implementations below... I got tguneysu's version to work, but bh your version is really simple... I should have figured this out myself.
as for the project: my son & I are trying to build a simulation of the card game Rummy...