I am looking for a possibility to initiate a variable in the if condition, so it is only valid in the scope of the condition.
Example: I want to transform this:
String tmp;
if ((tmp = functionWithALotOfProcessingTime()) != null)
{
// tmp is valid in this scope
// do something with tmp
}
// tmp is valid here too
Into something similar like this:
if ((String tmp = functionWithALotOfProcessingTime()) != null)
{
// tmp is *ONLY* in this scope valid
// do something with tmp
}