Task

Write a procedure which accepts as arguments another procedure and a positive integer.

The latter procedure is executed a number of times equal to the accepted integer.




 
Public Sub Main()
 
    RepeatIt("RepeatableOne", 2)
 
    RepeatIt("RepeatableTwo", 3)
 
End
 
'Cannot pass procedure pointer in Gambas; must pass procedure name and use Object.Call()
Public Sub RepeatIt(sDelegateName As String, iCount As Integer)
 
    For iCounter As Integer = 1 To iCount
        Object.Call(Me, sDelegateName, [])
    Next
 
End
 
Public Sub RepeatableOne()
 
    Print "RepeatableOne"
 
End
 
Public Sub RepeatableTwo()
 
    Print "RepeatableTwo"
 
End