代码格式化

发布于 6 年前作者 yingang12087 次浏览最后编辑 6 年前来自 ask

代码格式化是这样的:

if (flag == 1 && yemian.shop_price == ‘0.00’) {

    if (yemian.member_price != ‘0.00’) {

        yemian.shop_price = yemian.member_price;

    } else if (yemian.retail_price != ‘0.00’) {

        yemian.shop_price = yemian.retail_price;

    }

}

可不可以做成这样:

if (flag == 1 && yemian.shop_price == ‘0.00’)

{

    if (yemian.member_price != ‘0.00’)

    {

        yemian.shop_price = yemian.member_price;

    }

    else if (yemian.retail_price != ‘0.00’)

    {

        yemian.shop_price = yemian.retail_price;

    }

}

这样感觉很清晰

2 回复
jun01
jun011 楼6 年前

我写任何语言都是这样的风格,一目了然

chaoxiao
chaoxiao2 楼4 年前

一看你就是C系程序员 😀