Hi,
I am trying to write a custom code that returns some values after I do come basic percentage caldulations. Somehow the code keeps giving me error without any explanation of where in the code the error is.
Can someone help with this?
Hi,
I am trying to write a custom code that returns some values after I do come basic percentage caldulations. Somehow the code keeps giving me error without any explanation of where in the code the error is.
Can someone help with this?
Here is the code I have written so far
The line of code I have bolded is the one most likely causing the error but cant figure out whats wrong with it?
String? calculateImagePercentage(
int? image1,
int? image2,
int? image3,
int? image4,
int? calcFor,
int? imageNum,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
String percentValue = "";
if (imageNum == 2) {
if (imageNum == 1) {
if (image1 == 0) {
percentValue = "0%";
} else {
var n = ((image1 / (image1 + image2))*100).ceil();
percentValue = n.toString();
}
}
}
if (imageNum == 4) {
percentValue = "4";
}
return percentValue;
/// MODIFY CODE ONLY ABOVE THIS LINE
}