-----------------------------------------------------------
while (baby.isCrying())
{
baby.Burp();
if (!baby.isCrying())
{
output("your baby had gas");
exit;
}
if (baby.needsDiaperChange())
baby.changeDiaper();
if (!baby.isCrying())
{
output("your baby needed a change");
exit;
}
baby.Cuddle();
if (!baby.isCrying())
{
output("your baby needed a cuddle");
exit;
}
baby.Feed();
if (!baby.isCrying())
{
output("your baby was hungry");
exit;
}
baby.holdAndRockGently();
if (baby.isSleeping())
{
output("your baby was tired");
exit;
}
}
A colleague suggested to me that this might also need a try/catch block with the catch block containing MyDoctor.Call();
ReplyDelete