From: Dave Castellano Date: 2012-02-08T06:00:09+09:00 Subject: A better way? Hi, As I am learning to program, I am finding things I think can probably be done in a better way. The following code seems like something programmers must run into all the time and I am wondering if there is a better way to write the code in this situation. I'm having fun and trying to get better at this.... if random_insert == 0 correct_answer_shuffled = "A" elsif random_insert == 1 correct_answer_shuffled = "B" elsif random_insert == 2 correct_answer_shuffled = "C" elsif random_insert == 3 correct_answer_shuffled = "D" elsif random_insert == 4 correct_answer_shuffled = "E" end Is there a better way?? Thanks... Dave -- Posted via http://www.ruby-forum.com/.