Josselin wrote: > is it possible to test a condition (true-false) for each element in a > loop like this : > > for user in @users (user.has_role? ('manager')) > .... > end > > or shoudl I write an if condition inside the loop : > > for user in @users > if (user.has_role? ('manager')) > .... > end > end For starters, I would use #each instead of the `for' magic. Second, if you only wish to process a sub-group of the items, select those first, and then iterate over them: @users.select{|user| user.has_role? 'manager'}.each do |user| # ... end It may not be faster, but I think it's easier to read and understand. You could also split it up, if you prefer: managers = @users.select{|user| user.has_role? 'manager'} managers.each{|manager| ...} Cheers, Daniel