【发布时间】:2019-10-15 17:39:28
【问题描述】:
我尝试执行以下代码,但得到了:
"Encountered a syntax error while rendering template:"
这是我的看法:
%section
%article
- if @toss % 2 === 0
%p the player #{@player_one.name} start the fight !
- else
%p the player #{@player_two.name} start the fight !
- while @hp_player_one > 0 && @hp_player_two > 0
- @hp_player_one -= @player_two.attack
%p There is only #{@hp_player_one.to_s} point to #{@player_one.name}
- @hp_player_two -= @player_one.attack
%p There is only #{@hp_player_two.to_s} point to #{@player_two.name}
-if @hp_player_one <= 0 && @hp_player_two > 0
%p #{@player_one.name} lost
-elsif @hp_player_two <= 0 && @hp_player_one > 0
%p #{@player_two.name} lost
-else
%p draw !
我该如何解决?
【问题讨论】:
-
%p draw !看起来很可疑 -
看起来你已经用制表符而不是双空格缩进了。
-
@Kris 是的,但是 %p 抽奖出了什么问题?
标签: ruby ruby-on-rails-3 haml