What's Missing in this Code

Monkey Forums/Monkey Programming/What's Missing in this Code

c.k.(Posted 2012) [#1]
I'm getting a syntax error with the following code:

[monkeycode]
Class GameRecord
Field pattern_id:Int ' each pattern
Field scores:StringMap<Float> = New StringMap<Float>() ' has an interval array (keys) with associated scores (values)

Method New:VOID( intervals:Int[] )
For Local x:Int = 0 to g.dPatterns.Length() - 1
For Local t:Int = 0 to intervals.Count() - 1
scores.Set( String(x)+String(intervals[t]), 0 )
Next
Next
End

Method GetScore:Float( lvl:Int, interval:Int )
return scores.Get( String(lvl)+String(interval) )
End

Method SaveScore:VOID( lvl:Int, interval:Int, score:Float )
scores.Set( String(lvl)+String(interval), score )
End
End
[/monkeycode]

It says "Syntax error - expecting '('." and is referring to the line, "Method New:VOID( intervals:Int[] )"

So, there's a missing "(", but where does it go?! :-)

EDIT: Posted the whole chunk of code so it's seen in context.


Jesse(Posted 2012) [#2]
new method does not have a classification such as int, float or void. just remove the "VOID" from new.


c.k.(Posted 2012) [#3]
I would have sworn 100 times that I tried that! But that seems to fix this particular issue.

Thanks, Jesse! :-)


Samah(Posted 2012) [#4]
Array size is .Length not .Count()