Needing forward declaration in Ruby
Posted
by dbarbosa
on Stack Overflow
See other posts from Stack Overflow
or by dbarbosa
Published on 2010-05-08T15:34:43Z
Indexed on
2010/05/08
15:38 UTC
Read the original article
Hit count: 346
Hi,
I am trying to write a Ruby script in one file.
I would like to know if it is possible to write the "main" function in the beginning, having the other functions that are used by main, defined after it. In other words, I would like to call a not yet defined function, so that they do not depends on definition order. Just changing the order is not possible because it gives an "undefined method" error. In C/C++ we use forward declarations... is there something similar in Ruby or another solution to this?
© Stack Overflow or respective owner