2
Strict
Import mojo

Function Main:Int()
    CreateMapArray()
    Return 0
End

Function DrawRect:Int(x:Int, y:Int, w:Int, h:Int)

Function CreateMapArray:Int()
    Local MapArray:Int[10][]      'This code is for creating a 2D array to act as a map.
    For Local i:Int = 0 Until MapArray.Length()
        MapArray[i] = New Int[10]
    End
    Print("Here")
    For Local j:Int = 0 Until MapArray.Length()    'This code is to know where to put each rectangle in the 2D array/map.
        MapArray[j][9] = 1
        MapArray[0][j] = 1
        MapArray[9][j] = 1
        MapArray[j][0] = 1
        MapArray[j][8] = Rnd(0,2)
        Print(MapArray[j][8])
    End 
    For Local k:Int = 0 Until MapArray.Length()      'This code if for creating the rectangles.
        For Local l:Int = 0 Until MapArray.Length()
            If MapArray[k][l] = 1 Then
                DrawRect:Int(k, l, 5, 5)
            End
        End
    End
    Return 0
End

In this I'm getting an unexpected token 'function' error at line 'Function DrawRect:Int(x:Int, y:Int, w:Int, h:Int)'. By the way, this is done on Monkey X free version. Thank you for the help in advance.

Jose Faeti
  • 12,126
  • 5
  • 38
  • 52
Steven
  • 61
  • 1
  • 8
  • Hi OP, did you solve your issue? If my answer provided the solution, please consider accepting it. It helps the community :) – Jose Faeti Oct 21 '17 at 09:04

1 Answers1

0

You didn't close the DrawRect function with an End.

Function DrawRect:Int(x:Int, y:Int, w:Int, h:Int)

End <- missing bit

Or, you have to delete the DrawRect function declaration altogether.

Jose Faeti
  • 12,126
  • 5
  • 38
  • 52