I presume this somewhat artificial scenario isn't really what you're trying to answer, so I'm going to make the presumption that there's some value in some other case.
In languages with functional constructs, you can "select" items from a collection that match a condition.
In Ruby:
payment={cash=>true, credit=>true, check=>false}
methods_used=payment.select{ |key,value| value==true}.map { |key,value| key}
yields [:cash, :credit]
In C# 3:
var payment = new Dictionary<string, bool>
{{"cash", true}, {"credit",true}, {"check", false}};
var items=payment.Where(x => x.Value == true).Select(x => x.Key);
Console.WriteLine(String.Join(",",items.ToArray()));
In most languages that I can think of, you can't do what you're after straight from variable bindings without adding the variables to a collection or dictionary. There might be some sort of exception, but I can't think of one off the top of my head.
A closer approximation might be pattern matching in languages like Haskell, F# and OCaml, but I still can't quite find a way to make it look the way you're hinting.
In Boo, you could alter the compiler pipeline to replace the semantics of the if statement with something that would give you what you want. I would probably use an alternate keyword, but you could basically extract all the subexpressions, and add the variable names to the scope of the block, or add the "yes" values to one collection and the "nos" to another, and add a named variable by convention. In order to implement it usefully, you might have to break the convention of short-circuit evaluation, which would annoy most people used to contemporary programming language design.