# Re: ruby syntax

**URL:** <https://www.ruby-forum.com/t/re-ruby-syntax/56450>\
**Category:** Ruby\
**Created:** [March 31, 2006, 9:16am UTC](https://www.ruby-forum.com/t/re-ruby-syntax/56450 "2006-03-31T09:16:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vSnainar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/13edae/32.png) [@vSnainar](https://www.ruby-forum.com/u/vSnainar)\
**Post date:** [March 31, 2006, 9:16am UTC](https://www.ruby-forum.com/t/re-ruby-syntax/56450/1 "2006-03-31T09:16:20Z")

</div>

Hi!  
I wanted to write this :

```
       infile = File.new("foo")
       infile.each do ....

  but typed in
      infile.read do ...
             ----
  and it ran with no results - and no error messages . After a 

```

few minutes of puzzlement  
I found it. What does ruby do with the block if the method does  
not  
take one ? . Why doesn’t ruby check this kind of errors ?

nainar

---

<div class="post-metadata">

**Author:** ![vSnainar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/13edae/32.png) [@vSnainar](https://www.ruby-forum.com/u/vSnainar)\
**Post date:** [April 1, 2006, 1:49am UTC](https://www.ruby-forum.com/t/re-ruby-syntax/56450/2 "2006-04-01T01:49:13Z")

</div>

On Mar 31, 2006, at 2:14 AM, v. nainar wrote:

> I found it. What does ruby do with the block if the method does not  
> take one ? . Why doesn’t ruby check this kind of errors ?

It does nothing with the block. I imagine it doesn’t check if a  
method takes a block because you’d have to inspect the source of the  
method everytime to check if it took one or not, since methods can  
change.
