Ruby-on-Rails
  Home arrow Ruby-on-Rails arrow Page 4 - Ruby Operators and Arrays
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
RUBY-ON-RAILS

Ruby Operators and Arrays
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2007-10-16

    Table of Contents:
  • Ruby Operators and Arrays
  • Running for Precedence
  • Hashes
  • Home on the Range

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Ruby Operators and Arrays - Home on the Range


    (Page 4 of 4 )

    I wonder exactly how buffalo play. And what. Maybe when no one is looking they pull up an old log, light up a hickory pipe, and play a good game of chess, huffing and blowing smoke and mutter pip pip, cheerio a lot.

    Ranges in Ruby don't have buffalo on them (well I guess they could if you really wanted). They allow you to work with a set of items. For instance, January through December would be a range. A group of numbers would also be a range, as shown below.


    your_range = 1..10

    puts your_range

    This would print out the following:

     

      1

      2

      3

      4

    etc. You can also use the ... operator, which simply omits the final value:


    your_range = 1...10

    puts your_range

    Would print the values 1 through nine only. We'll get more into ranges in the next tutorial.

    That's right, I tricked you. Here you thought we would be doing Conditionals and Loops and all kinds of crazy statements. Well you were wrong. It was just a brilliant trick to get you to read the next tutorial (well that and I ran past my word limit). So stick with me and read the next tutorial, where we will get down and dirty with Ruby.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Thanks for dropping by to read this installment of my series on Ruby. This...
     

    RUBY-ON-RAILS ARTICLES

    - Creating Graphs with Ruby
    - Callbacks and the Active Record
    - Validation and the Active Record
    - Arrays, Associations and the Active Record
    - Associations and Dependencies with Active Re...
    - Advanced Active Record: Enhancing Your Models
    - Load Balancing Databases with Rails
    - More Advanced Database Features and Rails
    - Handling Advanced Database Features with Rai...
    - Managing Database Files with Ruby on Rails
    - Databases and Ruby on Rails
    - Updating and Deleting with the Active Record
    - Rails Active Record and CRUD Functions
    - Working with a Database: Active Record
    - The MVC Pattern in the Rails Framework







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 11 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek