SwitchUp SwitchUp Ranked Best Coding Bootcamps 2025

Check if a value exists in an array in Ruby

Altcademy Team wrote on 7 February 2018

You can use include?
>> ['A', 'B', 'C'].include? 'B' => true

Trusted by

Students and instructors from world-class organizations

Join the upcoming Cohort #111

Enroll for March 2nd, 2026