Seeing numbers in Ruby with r attached to the number -


when come across numbers in ruby code, mean?

1r 

or

1.0r 

tested in ruby 1.8.6 2.0.0 , fails. this:

>> 1r syntaxerror: unexpected tidentifier, expecting end-of-input 

and

>> 1.0r syntaxerror: unexpected tidentifier, expecting end-of-input 

probably downvoted not searching, or something, or not enough examples. clarifies. ruby code, doesn't have anywhere, has there.

that new feature decimal/rational literals in ruby 2.1. see here: http://rkh.im/ruby-2.1 (search "decimal literals")

0.1r      #=> (1/10) 0.1r * 3  #=> (3/10) 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -