first question as titled.
otherwise, what’s their relationship?? i had confuse about it.
and what’s the building package and class (do need to “require”, like
java.lang.* in Java )? how do i know it?
first question as titled.
otherwise, what’s their relationship?? i had confuse about it.
and what’s the building package and class (do need to “require”, like
java.lang.* in Java )? how do i know it?
I mean
“require” no need, just like
java.lang.* in Java
On Tue, 18 Sep 2007, Ruby N. wrote:
I mean
“require” no need, just like
java.lang.* in JavaOn Sep 19, 1:27 am, Ruby N. [email protected] wrote:
first question as titled.
otherwise, what’s their relationship?? i had confuse about it.
Classes and modules in the core are available without doing require.
Classes and modules in the standard library are brought in with require,
but there is not a one-to-one mapping like in Java. You can require a
file that defines 3 modules and 2 classes, for example.
and what’s the building package and class (do need to “require”, like
java.lang.* in Java )? how do i know it?
You need to read the documentation for each library that you use, to
know it.
If you are coming from java there are resources for people taking that
route, including a book. I have not read this book:
http://www.pragmaticprogrammer.com/title/fr_j2r/
Search google: ruby for java
It turns up many pages.
Hope this helps,
Hugh
huh??
for example, “PP”, i can find this package in both APIs. but need
“require”, so i still confuse. >"<
arr = [“apple”, “orange”, “watermelon”]
pp arr
#=> hello.rb:4: undefined method `pp’ for main:Object (NoMethodError)
require “pp”
arr = [“apple”, “orange”, “watermelon”]
pp arr
#=>[“apple”, “orange”, “watermelon”]
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs