新手问题 erb 中怎么用三元运算符?

zix · October 03, 2016 · Last by zix replied at October 03, 2016 · 1927 hits

我是这样写的。。

<%= player.badman == true "内奸" : "" %>

难道错了?

<%= player.badman ? "内奸" : "" %>

#3 楼 @gyorou
syntax error, unexpected ':', expecting ')' ...=( player.badman? "内奸" : "" );@output_buffer.safe_app... ... ^

中文问号。

写代码的时候符号切英文不是常识吗= =... ?和?的问题?

#5 楼 @Rei 果然。。光查了冒号没看问号

zix closed this topic. 03 Oct 17:42
You need to Sign in before reply, if you don't have an account, please Sign up first.