According to your description, the following code might be useful:
public static bool IsTrue(int[] array)
{
bool re = true;
for (int i = 0; i < array.Length-1; i++)
{
if (array[i] < array[i + 1])
{
re = false;
break;
}
}
return re;
}
But the third example also seems to be True, which is decreasing.
Update:
public static bool IsTrue(List<int> array)
{
bool re = true;
for (int i = 0; i < array.Count-1; i++)
{
if (array[i] < array[i + 1])
{
re = false;
break;
}
}
return re;
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.