Array simple question

Monkey Forums/Monkey Programming/Array simple question

Zurrr(Posted 2012) [#1]
Why I got error. Please. tnks
Import 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




c.k.(Posted 2012) [#2]
What therevills said.


therevills(Posted 2012) [#3]
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