Validating the Length of Each Array Element in Ruby

0
381

This guide explains how to validate the length of every element in an Array in Ruby.

Summary

Build a method that validates the length of every element of an Array in Ruby.

Exercise File

Code File

Exercise Description

Implement a method that ensures that all of the elements in a Ruby array are a certain length.

Sample Input

%w{words that have size requirements} # validate that all strings are at least 4 characters long

Expected Output

true

Real World Usage

This is a common Ruby interview question, specifically, this will test your knowledge of how to filter through an array for specific lengths.

Solution

Can be found on the solutions branch on github.

LEAVE A REPLY

Please enter your comment!
Please enter your name here