mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	 68b072bfba
			
		
	
	
		68b072bfba
		
	
	
	
	
		
			
			operator methods. * doc/syntax/methods.rdoc (Return Values): Added note that assignment methods ignore return values. * doc/syntax/precedence.rdoc: Added document describing precedence. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
		
			
				
	
	
		
			60 lines
		
	
	
	
		
			909 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
	
		
			909 B
		
	
	
	
		
			Text
		
	
	
	
	
	
| = Precedence
 | |
| 
 | |
| From highest to lowest, this is the precedence table for ruby.  High precedence
 | |
| operations happen before low precedence operations.
 | |
| 
 | |
|   !, ~, unary +
 | |
| 
 | |
|   **
 | |
| 
 | |
|   unary -
 | |
| 
 | |
|   *, /, %
 | |
| 
 | |
|   +, -
 | |
| 
 | |
|   <<, >>
 | |
| 
 | |
|   &
 | |
| 
 | |
|   |, ^
 | |
| 
 | |
|   >, >=, <, <=
 | |
| 
 | |
|   <=>, ==, ===, !=, =~, !~
 | |
| 
 | |
|   &&
 | |
| 
 | |
|   ||
 | |
| 
 | |
|   .., ...
 | |
| 
 | |
|   ?, :
 | |
| 
 | |
|   modifier-rescue
 | |
| 
 | |
|   =, +=, -=, etc.
 | |
| 
 | |
|   defined?
 | |
| 
 | |
|   not
 | |
| 
 | |
|   or, and
 | |
| 
 | |
|   modifier-if, modifier-unless, modifier-while, modifier-until
 | |
| 
 | |
|   { } blocks
 | |
| 
 | |
| Unary <code>+</code> and unary <code>-</code> are for <code>+1</code>,
 | |
| <code>-1</code> or <code>-(a + b)</code>.
 | |
| 
 | |
| Modifier-if, modifier-unless, etc. are for the modifier versions of those
 | |
| keywords.  For example, this is a modifier-unless expression:
 | |
| 
 | |
|   a += 1 unless a.zero?
 | |
| 
 | |
| <code>{ ... }</code> blocks have priority below all listed operations, but
 | |
| <code>do ... end</code> blocks have lower priority.
 | |
| 
 | |
| All other words in the precedence table above are keywords.
 | |
| 
 |