How do you remove specific element from array?


using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

#Finds an element in an array, then removes it.

test_array := class(creative_device):
    
    MyArray:[]int =array{1,2,3,4,5,6,7,8,9,10}

    @editable
    MyButton: button_device = button_device{}

    @editable
    MyValue: int = 10

    OnBegin<override>()<suspends>:void=
        Print("The length of the array is : {MyArray.Length}", ?Duration:=10.0)
        MyButton.InteractedWithEvent.Subscribe(Remover)          
        

            
    Remover(Agent:agent): void =

        if (ThisValue:=MyArray.Find[MyValue]):
            ThisValue
                    
            if(NewArray:=MyArray.RemoveElement[ThisValue]):
                Print("The length of the array is = {NewArray.Length}", ?Duration:=10.0)
                Print("The current values in the array are: " )
                for(i: NewArray):
                    Print("{i}")
    

Just an example to support the answer given.