DRYing up Rock Paper Scissors
问题 I'm a novice ruby programmer and although this code works, I'm wondering how I can improve it. I have very limited knowledge on lambdas and procs and the like, but any advice would be great. Is there any way to simplify the if else statements in each case? Also, is there any alternative way to the case statement skipped instead of making almost the entirety of the code one big if else statement? def rps(roll) roll_ops = ["rock", "paper", "scissors"] pick = roll_ops.sample result = nil if roll