Talk:Thoughts Around Making a Turn Based Strategy Game/@comment-75.139.82.189-20140324035204/@comment-24475768-20140329204230

I have some comments to make about the linked list. The implementation that Bobshmackee gave you is what you want.

But it's even better than that: since there are no arrays in Project Spark, if you want to make arrays with a dynamical size, the linked list implementation is also what you want. (There is a better way to do arrays with fixed size though, which is heavily using "call page", but I won't get into details about that here. I may do a page on arrays in this Wiki one day).

But more importantly, there are while loops in Project Spark. Here's how you do it:

to get "while(condition) do {code}", you have to put:

WHEN "for each of" "big value" (here, you want to put the size of your list, since the worst case is that you have to go through the whole list once) DO

> WHEN "not" "condition" DO "done executing" "for each of"

> WHEN DO {code}

The "done executing" is the "break" statement in programming languages.