How to call method in the another file

K

King Maker

Hello frends,

I write the method on one file and call this method on another file but
the problem is they not find the method of the another file

in first file i write:file_name=first.rb

def a()
puts "hello world"
end

in second file i write:file_name=second.rb

reqire 'd:\test\first.rb'

a()

its correct or not
 
I

Intransition

Hello frends,

I write the method on one file and call this method on another file but
the problem is they not find the method of the another file

in first file i write:file_name=3Dfirst.rb

=A0 def a()
puts "hello world"
end

in second file i write:file_name=3Dsecond.rb

reqire 'd:\test\first.rb'

a()

fix 'require' typo, but other than that is looks fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,076
Latest member
OrderKetoBeez

Latest Threads

Top