[newbie] What means 1_000_000

E

EdUarDo

Hi all,
trying ri and reading documentation for Benchmark I've seen an example
that says:

Benchmark.measure {"a"*1_000_000}

What's that literall? I've tried to do it with 1000000 instead of 1_000_000 and
it works too.

And what means the expression "a"*1000000? What do that?
 
L

Lutz Horn

EdUarDo said:
Benchmark.measure {"a"*1_000_000}

What's that literall? I've tried to do it with 1000000 instead of
1_000_000 and it works too.

It *is* the same, only more friendly for human readers.
And what means the expression "a"*1000000? What do that?

Why don't you just try it in irb?

irb(main):001:0> "a" * 10
=> "aaaaaaaaaa"

It's that simple :)

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,204
Messages
2,571,066
Members
47,672
Latest member
svaraho

Latest Threads

Top