# Ruby comprehensive "slow" reference

**URL:** <https://www.ruby-forum.com/t/ruby-comprehensive-slow-reference/100489>\
**Category:** Ruby\
**Created:** [July 29, 2006, 12:08pm UTC](https://www.ruby-forum.com/t/ruby-comprehensive-slow-reference/100489 "2006-07-29T12:08:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leslieviljoen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3d9bf3/32.png) [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Post date:** [July 29, 2006, 12:08pm UTC](https://www.ruby-forum.com/t/ruby-comprehensive-slow-reference/100489/1 "2006-07-29T12:08:25Z")

</div>

Hi!

I tried to find online explanations for the ‘%’ and ‘?’ operators used  
by Florian in an earlier post, but could not. The closest I saw were  
quick-references, but is there a comprehensive “slow” reference  
anywhere? None of the quick ones I saw listed those operators.

Les

---

<div class="post-metadata">

**Author:** ![leslieviljoen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3d9bf3/32.png) [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Post date:** [July 29, 2006, 1:30pm UTC](https://www.ruby-forum.com/t/ruby-comprehensive-slow-reference/100489/2 "2006-07-29T13:30:28Z")

</div>

On 7/29/06, Leslie V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi!
> 
> I tried to find online explanations for the ‘%’ and ‘?’ operators used

The ?X syntax is described here:  
[http://www.rubycentral.com/book/language.html#UC](http://www.rubycentral.com/book/language.html#UC)

In fact, it’s not an operator, it’s an integer literal.

The % operator is described within it’s class, String, referencing  
syntax of Kernel#sprintf.

When I started with ruby some time ago I was going crazy when I  
looked for something… Some pieces of information are scattered  
across too many places, especially Regexen are mentioned at three  
locations in the pickaxe book (1st edition) and I was hard to remember  
what piece is where. Now I got somewhat accustomed to this, so it’s no  
longer a problem for me. Now I mostly use rdoc and sometimes  
zenspider’s quickreference for bits that are missing from rdoc (or,  
that I still haven’t found there 😉

Now, what I want to say is, that maybe it would help to reorganize the  
docs a bit, or maybe just add some index pages to it

I really appreciate all the hard work which made the current state  
possible, and the gradual enhacements that are being made.

J.

---

<div class="post-metadata">

**Author:** ![leslieviljoen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3d9bf3/32.png) [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Post date:** [July 29, 2006, 1:30pm UTC](https://www.ruby-forum.com/t/ruby-comprehensive-slow-reference/100489/3 "2006-07-29T13:30:39Z")

</div>

> > > sender: “Leslie V.” date: “Sat, Jul 29, 2006 at 07:06:17PM +0900” \<\<\<EOQ  
> > > Hi!  
> > > Hi,

> I tried to find online explanations for the ‘%’ and ‘?’ operators used  
> by Florian in an earlier post, but could not. The closest I saw were  
> quick-references, but is there a comprehensive “slow” reference  
> anywhere? None of the quick ones I saw listed those operators.  
> Here’s one nice quick reference I just find a couple of days ago:  
> [Ruby | zenspider.com | by ryan davis](http://www.zenspider.com/Languages/Ruby/QuickRef.html)  
> Got that link from this site:  
> [http://mypage.bluewin.ch/yuppi/links/cheatsheets.html](http://mypage.bluewin.ch/yuppi/links/cheatsheets.html)  
> which may have references to other ruby quick refs as well, haven’t  
> taken a really good look at it.

However, that one is still too quick 🙂 it does not explain what you  
need, but here is a short explanation:

? is a conditional operator, e.g.

```
a = (1 == 2) ? 3 : 4 # => 4

```

% usually wears two hats… one is  
the modulus operator:

```
5 % 4 # => 1

```

the other one is to format strings:

```
"%08b" % 17 # => "00010001"
"%02X" % 17 # => "11"

```

Hope it helps,  
Alex
