Skip to content

Instantly share code, notes, and snippets.

@rikuTanide rikuTanide/if2.dart
Created Oct 11, 2017

Embed
What would you like to do?
どんどんReturnしていくIF文
Buyability checkBuyablility2(request) {
// ログインしていない
if (!checkLoggedIn(request)) {
var result = new Buyability();
result.check = false;
result.reason = "login";
return result;
}
// 在庫がないし再入荷もできない
if (!checkStock(request) && !canRestocked(request)) {
var result = new Buyability();
result.check = false;
result.reason = "stock";
return result;
}
// お金がない
if (!checkMoney(request)) {
var result = new Buyability();
result.check = false;
result.reason = "money";
return result;
}
var result = new Buyability();
result.check = true;
return result;
}
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.