int minutesPerPound;
if (isBoneless) {
minutesPerPound = 15;
} else {
minutesPerPound = 20;
}
How do we understand (isBoneless) what is this? and what does the “else” do in this code.
int minutesPerPound;
if (isBoneless) {
minutesPerPound = 15;
} else {
minutesPerPound = 20;
}
How do we understand (isBoneless) what is this? and what does the “else” do in this code.
[quote=“iOSMikey”]int minutesPerPound;
if (isBoneless) {
minutesPerPound = 15;
} else {
minutesPerPound = 20;
}
How do we understand (isBoneless) what is this? and what does the “else” do in this code.[/quote]
If isBoneless is evaluated to true(if) or false(else), then do something.
i.e:
if (isBoneless) // have isBoneless any value not equal to 0 ? (True)
minutesPerPound = 15; // do this statement
else // isBoneless equal to 0 (false)
minutesPerPound = 20; // do this statement
isBoneless is a BOOL type variable whose definition was not shown in the code snippet.