This is a discussion on Ruby on Rails within the Ruby forums, part of the Web Development category; Using Operators To get started using operators in Ruby, follow these steps: Enter this code in a new file, operators....
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#11
| |||
| |||
| Using Operators To get started using operators in Ruby, follow these steps:
Quote:
|
|
#12
| |||
| |||
| Ruby Operators Ruby Operators Operator Description [ ] Array reference [ ]= Array element set ** Exponentiation ! Not ~ Complement + Unary plus - Minus * Multiply / Divide % Modulo + Plus - Minus >> Right shift << Left shift & Bitwise And ^ Bitwise exclusive Or (Xor) | Regular Or Comparison operators: <= Less than or equal to < Less than > Greater than >= Greater than or equal to Equality and pattern match operators: <=> Less than, equal to, greater than == Equal to === Tests equality in a when clause of a case statement != Not equal to =~ Regular expression pattern match && Logical And || Logical Or .. Inclusive range ... Exclusive range ? Ternary if : Else Assignment = Normal assign %= Modulus and assign /= Divide and assign -= Subtract and assign += Add and assign *= Multiply and assign **= Exponent and assign defined? True if symbol defined not Logical negation and Logical composition or Logical composition Statement modifiers if unless while until begin/end Block expression |
|
#13
| |||
| |||
| Working with Arrays There are plenty of ways to work with data in Ruby. Next up is to store it in arrays. Arrays act as groups of variables, and you can access each variable in an array with an index number. For example, to create an array, you use the [] operator like this: array = [1, 2, 3] This creates an array with three elements, 1, 2, and 3. You access those elements using an array index like this: Quote:
Quote:
Here’s an example: array = [“Hello”, “there”, “sweetie”, 1, 2, 3] This creates an array filled with six elements, three of which are text and three of which are numbers: Quote:
|
|
#14
| |||
| |||
| Hi Nice Prasanna. You doin a good job. It is so helpful for me. I know the HTML and now i want to upgrade my self, so i thinking about the ROR or PHP. I think ROR has nice future. so i looking for the ROR. thanks |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Installing Ruby and Rails on Windows | prasannavigneshr | Ruby | 3 | 01-09-2009 04:24 AM |
| PHP vs Ruby | suman | PHP Programming | 2 | 10-02-2008 12:59 AM |
| Ruby on Rails server config | vivekanandan | Ruby | 7 | 08-04-2007 04:02 AM |
| setting up ruby on rails in Fedora core 6 | rgm5 | Ruby | 1 | 04-17-2007 11:42 PM |
| Ruby IDE | drecko | Ruby | 0 | 02-16-2007 12:11 AM |
Our Partners |