Im just learning trough the "geting started with ruby" i''m only on page Ruby.new and im stuck here''s the thing, I''m using FreeRIDE to duplicate the examples a = %w{ ant bee cat dog elk } a[0] ? "ant" a[3] ? "dog" for the live of me i cant seem to use Alt+0187 (?) what happen?? -- Posted via http://www.ruby-forum.com/.
I believe this is just showing you what data is stored in which slot in the array. a[0] contains "ant", etc. On 3/13/06, Bobby <damienov@gmail.com> wrote:> > Im just learning trough the "geting started with ruby" > i''m only on page Ruby.new and im stuck > here''s the thing, I''m using FreeRIDE to duplicate the examples > > a = %w{ ant bee cat dog elk } > a[0] ? "ant" > a[3] ? "dog" > > for the live of me i cant seem to use Alt+0187 (?) > what happen?? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060313/ac88b99d/attachment.html
You don''t need to actually type in the "?". In the code, that convention is used to show you the output/value of the expression on the left. On 3/13/06, Bobby <damienov@gmail.com> wrote:> Im just learning trough the "geting started with ruby" > i''m only on page Ruby.new and im stuck > here''s the thing, I''m using FreeRIDE to duplicate the examples > > a = %w{ ant bee cat dog elk } > a[0] ? "ant" > a[3] ? "dog" > > for the live of me i cant seem to use Alt+0187 (?) > what happen?? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Michael Gorsuch wrote:> I believe this is just showing you what data is stored in which slot in > the > array. > > a[0] contains "ant", etc.mmm sorry for the misunderstanding but what I meant is, why cant I enter [ ?? ] with the FreeRIDE I tried pressing Alt+0187 in my keyboard and nothing happen -- Posted via http://www.ruby-forum.com/.
Jim McFarland wrote:> You don''t need to actually type in the "?". In the code, that > convention is used to show you the output/value of the expression on > the left.Thank you for helping me but please bear with me for a moment :) could you give me an example? -- Posted via http://www.ruby-forum.com/.
This might explain it better than me: http://www.rubycentral.com/book/preface.html Go there and read the section on "Notation Conventions". On 3/13/06, Bobby <damienov@gmail.com> wrote:> Jim McFarland wrote: > > You don''t need to actually type in the "?". In the code, that > > convention is used to show you the output/value of the expression on > > the left. > Thank you for helping me but please bear with me for a moment :) > could you give me an example? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 3/13/06, Bobby <damienov@gmail.com> wrote:> Michael Gorsuch wrote: > > I believe this is just showing you what data is stored in which slot in > > the > > array. > > > > a[0] contains "ant", etc. > > mmm sorry for the misunderstanding > but what I meant is, why cant I enter [ ?? ] with the FreeRIDE > I tried pressing Alt+0187 in my keyboard and nothing happenYou don''t need to enter that character. That character and anything after it is not part of the actual sample code.
Jim McFarland wrote:> This might explain it better than me: > > http://www.rubycentral.com/book/preface.html > > Go there and read the section on "Notation Conventions".So the ? is just a sample of the output? -- Posted via http://www.ruby-forum.com/.
a[0] ? "ant" a[3] ? "dog" is equivalent to "reading" a[0] has a value of "ant" a[3] has a value of "dog" it''s strictly there for visualization purposes and has not meaning outside that context, ie, it''s not code. On 3/13/06, Bobby <damienov@gmail.com> wrote:> > Jim McFarland wrote: > > This might explain it better than me: > > > > http://www.rubycentral.com/book/preface.html > > > > Go there and read the section on "Notation Conventions". > So the ? is just a sample of the output? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060313/07e8c23b/attachment.html
Chris Hall wrote:> a[0] ? "ant" > a[3] ? "dog" > > is equivalent to "reading" > > a[0] has a value of "ant" > a[3] has a value of "dog" > > it''s strictly there for visualization purposes and has not meaning > outside > that context, ie, it''s not code.Ahh I see Thank you all for your help :) -- Posted via http://www.ruby-forum.com/.