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?
it’s just for readability!
1_000 is similar to 1000
puts “x” * 20
xxxxxxxxxxxxxxxxxxxx
it just duplicates a string multiple times (in this case 20)
EdUarDo [email protected] writes:
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