Skip to content

Instantly share code, notes, and snippets.

@rikuTanide rikuTanide/if1.dart
Last active Oct 11, 2017

Embed
What would you like to do?
途中でReturnしないIF文
Buyability checkBuyablility(request) {
var result = new Buyability();
// ログインしているか
if (checkLoggedIn(request)) {
// 在庫があるか
if (checkStock(request)) {
// お金は足りているか
if (checkMoney(request)) {
result.check = true;
} else {
result.check = false;
result.reason = "money";
}
} else {
// 再入荷可能か
if (canRestocked(request)) {
// お金は足りているか
if (checkMoney(request)) {
result.check = true;
} else {
result.check = false;
result.reason = "money";
}
} else {
result.check = false;
result.reason = "stock";
}
}
} else {
result.check = false;
result.reason = "login";
}
return result;
}
class Buyability {
bool check;
String reason;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.