if语句中的多个条件(液体) [英] Multiple conditions in if statement (Liquid)

查看:87
本文介绍了if语句中的多个条件(液体)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Shopify Liquid中的单个 if 语句中放入多个条件?

Is it possible to put multiple conditions inside a single if statement in Shopify Liquid?

例如,这就是我所拥有的:

For example this is what I have:

{% if product.type != "A" and product.type != "B" and product.type != "C" %}
//do something
{% endif %}

我想知道的原因是,语法突出显示在第一个和"运算符之后停止,好像其后的所有语法都不正确.

The reason I'm wondering is because syntax highlighting stops after the first "and" operator, as if everything after that has incorrect syntax.

推荐答案

您的语法是100%有效的,并且可以在Shopify中使用

Your syntax is 100% valid and will work in Shopify

{% if product.type != "A" and product.type != "B" and product.type != "C" %}
    //do something
{% endif %}

我猜您正在使用的编辑器在液体语法突出显示程序中存在错误.这就是为什么你困惑

I guess the editor what you are using has a bug in syntax highlighter for liquid. That's why you confused

这篇关于if语句中的多个条件(液体)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆