S
S
Sticky Rain2020-11-05 16:19:58
C++ / C#
Sticky Rain, 2020-11-05 16:19:58

Explain what this C# code does?

public int[] values;
public int lowNumber;

lowNumber = values[0];

        for (int i = 0; i < values.Length; i++)
        {
            if (values[i] < lowNumber)
            {
                lowNumber = values[i];
            }
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-11-05
@stiicky

searches for the smallest
although this code will fall out
var lover = values.Min();
This will be both more compact and faster

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question