Calculate nesting of ifs