Home
Ruby
ActiveRecord
Array
CGI
Class
Collections
Database
Date
Design Patterns
Development
File Directory
GUI
Hash
Language Basics
Method
Network
Number
Rails
Range
Reflection
Statement
String
Threads
Time
Tk
Unit Test
Windows Platform
XML
Menu
Variable based range : Range Creation « Range « Ruby
Ruby
Range
Range Creation
Variable based range
x = 2 puts x+1..x*x
Related examples in the same category
1.
what are Ranges
2.
With the Range class, you can also create a range
3.
To create a range, use the .. operator. For example, here's how you might create the range 1 to 4:
4.
use the ... operator, which is the same thing except that the final item in the range is omitted
5.
Reference to_a from a range
6.
Reference to_a from a range in an excluded range
7.
Reference to_a from a letter-based range
8.
You have to create ranges in ascending sequence