Help me: How to get the highest number in an array

Help me: How to get the highest number in an array

I want to obtain the highest number of my array passed through that function, but I can’t do it…

Someone help me please!

    Sel_Asesino(Float : []float): void =
        Print("Selecion del asesino dependiendo del los numeros")

        Values := for (X : Float):
            Print("Paso por el for de asesino para comprobar cual tiene el numero mayor")
            Print("El valor de X cuando entro en el for:{X}")
            Print("El valor de TemporalAsesino cuando entro en el for:{TemporalAsesino}")
            

            if(X >= TemporalAsesino):
                Print("Entro aqui en el if")
                Print("El valor de X cuando entro en if:{X}")
                Print("El valor de X cuando entro en if:{X}")
                Temporal + TemporalAsesino

            TemporalAsesino + X 
            X + 1.0
            
GetHighest(Floats:[]float)<transacts>:float=
    if(var TempHighest :float= Floats[0]):
        for(CurrentFloat:Floats):
            if(CurrentFloat>TempHighest). set TempHighest = CurrentFloat
        return TempHighest
    else return -1.0

This should be a simple GetHighes Number function that you can use. If the array provided has no float numbers it will return a -1

1 Like

Super grateful, I wish there were more people like you! you helped me a lot!

Great contribution for me and our community <3

1 Like

Glad to help :heart:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.