当前位置:网站首页>Why should two judgment expressions in if be written in two lines

Why should two judgment expressions in if be written in two lines

2022-06-13 07:07:00 guangsu.

 while (!is_empty()) {
    
        p = dequeue();
        show_p(p);
        if (p.row == MAX_ROW - 1  /* goal */
            && p.col == MAX_COL - 1)
            break;
        if (p.col+1 < MAX_COL     /* right */
            && maze[p.row][p.col+1] == 0)
            visit(p.row, p.col+1);
        if (p.row+1 < MAX_ROW     /* down */
            && maze[p.row+1][p.col] == 0)
            ...
 }

Today, I came across the benefits of writing like this , When IDE When debugging ,source Level step Which step to stay at is quite obvious

原网站

版权声明
本文为[guangsu.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270550305241.html