sclass WaitForAnswer_YesNo { swappable S answer(S s) { if (isYes(s)) { cancel(); ret processAnswer(true); } if "no" { cancel(); ret processAnswer(false); } ret otherInput(s); } swappable bool isYes(S s) { ret main isYes(s); } swappable bool isNo(S s) { ret main isNo(s); } swappable S otherInput(S s) { ret "I don't understand. Yes or no?"; } swappable S processAnswer(bool yes) { ret "You said " + yesNo_short(yes); } swappable void cancel() { print("Cancelling"); } }