Using Any?, All?, and None? Predicates in Ruby
📖 Scenario: You are working on a simple system that checks a list of tasks to see if they meet certain conditions. This helps you decide if all tasks are done, if any task is urgent, or if none are overdue.
🎯 Goal: Build a Ruby program that uses any?, all?, and none? methods to check conditions on a list of tasks.
📋 What You'll Learn
Create an array of hashes called
tasks with specific task detailsCreate a variable
urgent_threshold to define urgencyUse
any? to check if any task is urgentUse
all? to check if all tasks are completedUse
none? to check if no tasks are overduePrint the results exactly as specified
💡 Why This Matters
🌍 Real World
Checking lists of tasks or items to quickly find if any, all, or none meet certain conditions is common in apps like to-do lists, inventory checks, or quality control.
💼 Career
Understanding these predicates helps in writing clean, readable code for filtering and decision-making in software development.
Progress0 / 4 steps