Topic: Help. I Need Some Answers to These Simple Ruby Questions

Good day.

I need some help on this.
How would I access the following?
1) A global variable called data.
2) A local variable of a function called index.
3) A constant called PI defined in a class called Maths.
4) An instance variable called counter.
5) A class variable called timestamp.

Thank you very much. I would really appreciate your help.

Re: Help. I Need Some Answers to These Simple Ruby Questions

tongue This sounds almost like a simple CS worksheet than an actual set of questions, but I'll answer anyways.

1) $data
2) index
3) Math:: PI (remove the space, I added it to prevent the forum software from making tongue)
4) @counter
5) @@timestamp

Last edited by manitoba98 (2008-01-17 22:18:24)

Re: Help. I Need Some Answers to These Simple Ruby Questions

Thanks. Really? It looked like a quiz. I just made it look neat. Thanks again!:)