【发布时间】:2020-04-15 20:53:00
【问题描述】:
我的代码中&& 的完美更改是什么?我真的不明白如何解决它。这是我到目前为止的代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class A3 : MonoBehaviour
{
int[] arr = new int[3] { -7, 2, 6 };
int reBig ()
{
if (arr[0] > arr[1] && arr[2])
{
return (arr[0]);
}
else if (arr[1] > arr[0] && arr[2])
{
return (arr[1]);
}
else if (arr[2] > arr[0] && arr[1])
{
return (arr[2]);
}
}
// Start is called before the first frame update
void Start()
{
print(reBig());
}
// Update is called once per frame
void Update()
{
}
}
【问题讨论】:
-
试试
arr.Max(); -
@ja72 这看起来像是家庭作业,他不太可能被允许使用它。
标签: c#