一行 if 语句不起作用 [英] One line if statement not working
本文介绍了一行 if 语句不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<%if @item.rigged %>Yes<%else%>No<%end%>
我在想这样的事情吗?
if @item.rigged ? "Yes" : "No"
但它不起作用.Ruby 有 ||=
但我什至不知道如何使用那个东西.
But it doesn't work. Ruby has the ||=
but I"m not even sure how to use that thing.
推荐答案
Remove if
from if @item.rigged ?是":否"
Remove if
from if @item.rigged ? "Yes" : "No"
三元运算符具有形式 condition ?if_true : if_false
这篇关于一行 if 语句不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文