For the more curious: conditional operators


#1

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.


#2

[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


#3

isBoneless is a BOOL type variable whose definition was not shown in the code snippet.