Blank line Elixir template

Asked

Viewed 40 times

1

This code displays a message if it exists, but when it does not exist, displays a white line:

<%= if @comprovante["transacao"]["complemento"] do %>OBSERVACAO: <%= @comprovante["transacao"]["complemento"]%><% else %><% end %>

how do I not display this blank line?

1 answer

1

The blank line that is being displayed is Else condition and as it has nothing is returning nil, which makes it a blank line, to avoid just remove the Else or put a return to the same.

<%= if @comprovante["transacao"]["complemento"] do %> OBSERVACAO: <%= @comprovante["transacao"]["complemento"]%><% end %>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.