if num=~ /\d+/ buy_num=num.to_i else buy_num=1 end1down voteacceptYou forgot to include the class you were testing against:"1".is_a?(Integer) # false1.is_a?(Integer) # true