Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChris Ward
12,129 PointsWrite a condition class
Ok, suppose you are writing a program that relies on testing a lot of conditions often. Using static variables (@@ in Ruby) and block references, write a class that takes as its initializer a string representing a condition and a block reference that can be called to determine if the condition is currently true. As I said, you can use static variables inside the block so that you never lose track of the variables that you need to test the condition of.
Happy Coding!