Ruby - 方法问题

时间:2016-09-14 12:44:50

标签: ruby

我在这里创建了3个方法,我还需要一个输出最终成功消息而不是圆形成功消息。

// Used ES7 async/await
const member = await Member.create({ ... });
const addition1 = await MemberAddition.create({ ... });
const addition2 = await MemberAddition.create({ ... });

await addition1.setMember(member);
await addition2.setMember(member); // Should be failed or set addition1 MemberId null

1 个答案:

答案 0 :(得分:2)

def display_results(player, computer, counts)
  prompt(
    case
    when counts[:player] == 3 then "You won the game! Congrats!"
    when counts[:computer] == 3 then "Computer won the game. Try again?"
    when win?(player, computer) then "You won this round!"
    when win?(computer, player) then "Computer won this round! You loose!"
    else "It's a tie on this round! No one wins!"
    end
  )
end

应该在轮次结果之前检查游戏结果