代码格式化
发布于 5 年前 作者 yingang 11947 次浏览 来自 问答

代码格式化是这样的:

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 回复

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

一看你就是C系程序员 😀

回到顶部