Hi guys, I was wondering…
In this mini challenge, I was supposed to call my method with two floats. What I did instead is use the two variables we already had so I used a float and an int. The method still works perfectly so I guess my int was converted into a float by the method “Average”?
void Start () {
int anInteger = 2;
float aFloat = 2.5f;
print("anInteger = " + anInteger);
print("aFloat = " + aFloat);
print("average = " + Average(anInteger, aFloat));
print("square aFloat = " + Square(Square(aFloat)));
}
float Square (float x) {
return x * x;
}
float Average (float x, float y) {
return (x + y) / 2;
}