Array simple question
Monkey Forums/Monkey Programming/Array simple question
| ||
Why I got error. Please. tnksImport mojo Class MyApp Extends App Field arraytest:String[] Method OnCreate() arraytest[]=["bla","bla..","blaaa..."] SetUpdateRate 15 End Method OnUpdate() End Method OnRender() End End Function Main() New MyApp End |
| ||
What therevills said. |
| ||
Because you've got too many square brackets ;) Change: arraytest[]=["bla","bla..","blaaa..."] to: arraytest = ["bla","bla..","blaaa..."] Import mojo Class MyApp Extends App Field arraytest:String[] Method OnCreate() arraytest =["bla", "bla..", "blaaa..."] SetUpdateRate 15 End Method OnUpdate() End Method OnRender() Cls Local gap:Int = 0 For Local s:String = eachin arraytest DrawText s, 10, 20 + gap gap += 10 Next End End Function Main() New MyApp End |