# Difference between \<%= end %\> \<%= end -%\>

**URL:** <https://www.ruby-forum.com/t/difference-between-end-end/88673>\
**Category:** Rails\
**Created:** [March 13, 2007, 1:50pm UTC](https://www.ruby-forum.com/t/difference-between-end-end/88673 "2007-03-13T13:50:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@rita](https://www.ruby-forum.com/u/rita)\
**Post date:** [March 13, 2007, 1:50pm UTC](https://www.ruby-forum.com/t/difference-between-end-end/88673/1 "2007-03-13T13:50:08Z")

</div>

Hi,

```
I am reffering to "Agile Web D. with Rails 2nd ed B1

```

21.pdf" As per this book,

```
<% 3.downto(1) do |count| -%>
<%= count %>...<br />
<% end -%>
Merry Christmas!

The minus sign in end will supress the newline. This is not

```

happening in my case.  
I am using ruby 1.8.4 and Rails 1.2.2

What could be the reason?

---

<div class="post-metadata">

**Author:** ![rita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@rita](https://www.ruby-forum.com/u/rita)\
**Post date:** [March 13, 2007, 2:22pm UTC](https://www.ruby-forum.com/t/difference-between-end-end/88673/2 "2007-03-13T14:22:13Z")

</div>

On Mar 13, 12:49 pm, “rita” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> The minus sign in end will supress the newline. This is not
> 
> ```
> 
> happening in my case.

The generated HTML code should look like this:

3…  
  
2…  
  
1…  
  
Merry Christmas!

If you leave out the minus sign, it should look like this:

3…  
  
2…  
  
1…

Merry Christmas!

Is that what you’re seeing, or are you getting something else? Note  
that the minus sign only suppresses the literal newline in the  
generated HTML code, not the   
 tag which makes your browser  
display a newline when it renders the HTML.

Chris

---

<div class="post-metadata">

**Author:** ![rita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@rita](https://www.ruby-forum.com/u/rita)\
**Post date:** [March 14, 2007, 9:16am UTC](https://www.ruby-forum.com/t/difference-between-end-end/88673/3 "2007-03-14T09:16:51Z")

</div>

On Mar 13, 6:21 pm, “Chris M.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ```
> > Merry Christmas!
> > 
> > ```
> 
> generated HTML code, not the   
> tag which makes your browser  
> display a newline when it renders the HTML.
> 
> Chris

Though I will keep the minus sign or remove it I am getting the output  
as:

3…  
  
2…  
  
1…  
  
Merry Christmas!

Rita.

---

<div class="post-metadata">

**Author:** ![rita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@rita](https://www.ruby-forum.com/u/rita)\
**Post date:** [March 14, 2007, 11:28am UTC](https://www.ruby-forum.com/t/difference-between-end-end/88673/4 "2007-03-14T11:28:44Z")

</div>

rita wrote:

> On Mar 13, 6:21 pm, “Chris M.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > > ```
> > > Merry Christmas!
> > > 
> > > ```
> > 
> > generated HTML code, not the   
> > tag which makes your browser  
> > display a newline when it renders the HTML.
> > 
> > Chris
> 
> Though I will keep the minus sign or remove it I am getting the output  
> as:
> 
> 3…  
>   
> 2…  
>   
> 1…  
>   
> Merry Christmas!
> 
> Rita.

ok try this

the -%\> would remove the \n in the HTML tag, you shouldn’t worry about  
🙂
