On Mon, Nov 21, 2016 at 9:18 PM, Die Optimisten
<inform / die-optimisten.net> wrote:

>> 'unless /../;$_=nil end'
>
> So you can leave out the then ? ok, but I'ld prefer to have fixed syntax in
> a language

Ruby's syntax _is_ fixed.

> (sometimes do or begin (not interchangeable), some ends without begin... -
> thats confusing)

You'll get used to it.

> Another question:
> Is there a better way than eval to convert "number" data to its contents?
> x="3"   => .to_i y=3
> x="3.3" => y=3.3
> x="0xa" => ? # y=16
> like printf with auto-detection of thze type

Better start a new thread for the new subject

irb(main):005:0> %w{3 3.3 0xa}.each {|x| y = Integer(x) rescue
Float(x); p y, y.class}
3
Fixnum
3.3
Float
10
Fixnum
=> ["3", "3.3", "0xa"]

Cheers

robert

-- 
[guy, jim, charlie].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/

Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>