# Unexpected, Expected

**URL:** <https://www.ruby-forum.com/t/unexpected-expected/59927>\
**Category:** Rails\
**Created:** [May 8, 2006, 7:51pm UTC](https://www.ruby-forum.com/t/unexpected-expected/59927 "2006-05-08T19:51:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohammad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mohammad](https://www.ruby-forum.com/u/mohammad)\
**Post date:** [May 8, 2006, 7:51pm UTC](https://www.ruby-forum.com/t/unexpected-expected/59927/1 "2006-05-08T19:51:10Z")

</div>

Okay I got ther error below in figure-1, so I added an end then I got  
figure-2  
figure-1  
expecting tCOLON2 or ‘[’ or ‘.’  
figure-2  
unexpected ‘;’, expecting tCOLON2 or ‘[’ or ‘.’  
end ; \_erbout

---

<div class="post-metadata">

**Author:** ![mohammad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mohammad](https://www.ruby-forum.com/u/mohammad)\
**Post date:** [May 8, 2006, 8:14pm UTC](https://www.ruby-forum.com/t/unexpected-expected/59927/2 "2006-05-08T20:14:35Z")

</div>

Mohammad wrote:

> Okay I got ther error below in figure-1, so I added an end then I got  
> figure-2  
> figure-1  
> expecting tCOLON2 or ‘[’ or ‘.’  
> figure-2  
> unexpected ‘;’, expecting tCOLON2 or ‘[’ or ‘.’  
> end ; \_erbout

This rather unhelpful error message indicates that you’ve got a syntax  
error  
somewhere. You’ll just have to track it down.

Dan

This communication is the property of Qwest and may contain confidential  
or  
privileged information. Unauthorized use of this communication is  
strictly  
prohibited and may be unlawful. If you have received this communication  
in error, please immediately notify the sender by reply e-mail and  
destroy  
all copies of the communication and any attachments.

---

<div class="post-metadata">

**Author:** ![mohammad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mohammad](https://www.ruby-forum.com/u/mohammad)\
**Post date:** [May 8, 2006, 9:10pm UTC](https://www.ruby-forum.com/t/unexpected-expected/59927/3 "2006-05-08T21:10:43Z")

</div>

# Panel for \<%= @user.login %\>

### Army
\<% for @army\_types.each do |running| %\> \<% if @user.running != nil %\> \<%= @army\_names[@cell1] %\>: \<%= @user.running %\>  
\<% end %\> \<% @cell1 += 1 %\> \<% end %\> thats the code

---

<div class="post-metadata">

**Author:** ![mohammad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mohammad](https://www.ruby-forum.com/u/mohammad)\
**Post date:** [May 8, 2006, 9:36pm UTC](https://www.ruby-forum.com/t/unexpected-expected/59927/4 "2006-05-08T21:36:42Z")

</div>

Mohammad wrote:

> # Panel for \<%= @user.login %\>
> 
> ### Army
> \<% for @army\_types.each do |running| %\> \<% if @user.running != nil %\> \<%= @army\_names[@cell1] %\>: \<%= @user.running %\>  
> \<% end %\> \<% @cell1 += 1 %\> \<% end %\> thats the code

Check your .each line.

---

<div class="post-metadata">

**Author:** ![mohammad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mohammad](https://www.ruby-forum.com/u/mohammad)\
**Post date:** [May 8, 2006, 9:57pm UTC](https://www.ruby-forum.com/t/unexpected-expected/59927/5 "2006-05-08T21:57:15Z")

</div>

Alex Y. wrote:

> Mohammad wrote:
> 
> > # Panel for \<%= @user.login %\>
> > 
> > ### Army
> > \<% for @army\_types.each do |running| %\> \<% if @user.running != nil %\> \<%= @army\_names[@cell1] %\>: \<%= @user.running %\>  
> > \<% end %\> \<% @cell1 += 1 %\> \<% end %\> thats the code
> 
> Check your .each line.  
> thats not the error, I really want to know whats going down, this has  
> been staling me for weeks now

---

<div class="post-metadata">

**Author:** ![mohammad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mohammad](https://www.ruby-forum.com/u/mohammad)\
**Post date:** [May 8, 2006, 10:08pm UTC](https://www.ruby-forum.com/t/unexpected-expected/59927/6 "2006-05-08T22:08:30Z")

</div>

> > > # Panel for \<%= @user.login %\>
> > > 
> > > ### Army
> > > \<% @army\_types.each do |running| %\> \<% if @user.running != nil %\> \<%= @army\_names[@cell1] %\>: \<%= @user.running %\>  
> > > \<% end %\> \<% @cell1 += 1 %\> \<% end %\> thats the code

it’s the “for” above is the code now but, I can’t do @user.running is  
there a way to do somthing like that?

---

<div class="post-metadata">

**Author:** ![mohammad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mohammad](https://www.ruby-forum.com/u/mohammad)\
**Post date:** [May 8, 2006, 10:53pm UTC](https://www.ruby-forum.com/t/unexpected-expected/59927/7 "2006-05-08T22:53:32Z")

</div>

Mohammad wrote:

> > > \<% @cell1 += 1 %\>  
> > > \<% end %\>  
> > > thats the code
> > 
> > Check your .each line.
> 
> thats not the error, I really want to know whats going down, this has  
> been staling me for weeks now  
> Check it again.

irb(main):001:0\> l = [1,2,3]  
=\> [1, 2, 3]  
irb(main):002:0\> for l.each do |line|  
irb(main):003:1\* puts line  
irb(main):004:1\> end  
SyntaxError: compile error  
(irb):4: parse error, unexpected ‘\n’, expecting tCOLON2 or ‘[’ or ‘.’  
from (irb):4

---

<div class="post-metadata">

**Author:** ![mohammad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mohammad](https://www.ruby-forum.com/u/mohammad)\
**Post date:** [May 8, 2006, 10:53pm UTC](https://www.ruby-forum.com/t/unexpected-expected/59927/8 "2006-05-08T22:53:37Z")

</div>

Mohammad wrote:

> it’s the “for” above is the code now but, I can’t do @user.running is  
> there a way to do somthing like that?  
> What are your models? What is the schema? What are you expecting  
> @user.running to return?
