I have this logic in my analysis file.
The user has the option to choose a input file. if an error occurs or if the user has a invalid entry in the input file, then the logic checks and prints the error.
This method returns a bool success. Depending on if all the input is valid, successtakes T/F.
If success = T, then the next step analyzing the input starts.
Now here’s my question. How do i return a false`
;
if (xxx > 100)
{
errMsg = "Number of xxx should be <= 100";
swRpt.WriteLine(errTitle + errMsg);
}
// sizing
;
swRpt.WriteLine(" Epsilon");
//Repair
success = Numerical.Check("repair", inputs.repair.ToString(),
out dtester, out errMsg);
if (!success)
{
swRpt.WriteLine(errTitle + errMsg);
}
success = Numerical.Check("prob", inputs.prob.ToString(),
out dtester, out errMsg);
if (!success)
{
swRpt.WriteLine(errTitle + errMsg);
}
so now finally
if (success)
{
//run the analysis method
}
if(!success)
{
exit
}
I need to exit if even one input is wrong. the first could be wrong and the last one could be a correct input value.
You can add another status flag that will be updated to false anytime there is a failure: