I am trying to create an int array and assign random numbers from 1-4 to it.
So the end result could be something like:
{1, 3, 3, 1, 4}
{2, 3, 1, 4, 2}
{4, 1, 2, 4, 4}
I am running into the error “This invocation calls a function that has the ‘decides’ effect, which is not allowed by its context.”
But when I add the < decides > I get a different error of “Function is invoked with incorrect failure bracketing style.” when calling StartFunction()
Any help appreciated, thank you!
OnBegin<override>()<suspends>:void=
        StartFunction() # when I add decides below this line shows an error
    StartFunction():void=
        Print("=StartFunction called=", ?Duration := 20.0)
        MyArray : []int = array{0, 0, 0, 0, 0}
        
        for (Index := 0..MyArray.Length-1):
            set TempRandomInt = GetRandomInt(1,4)
            if (Element := MyArray[Index]):
                MyArray[Index] = TempRandom #this line is the error
                
                Print("{Element} in MyArray at index {Index}", ?Duration := 30.0)
                Print("Random num = {TempRandom} ", ?Duration := 30.0)
Thank you