-----BEGIN PGP SIGNED MESSAGE-----
Will M. wrote:
| 10000000.times do
| puts time1+1
| All it would do, is simply print out the number 2, 10000000 times. I
| continually got errors when editing it. Could someone please assist?
Well, it’s as simple as adding a ‘=’:
time1 = 1
~ time1 += 1 # this is shorthand for time1 = time1 + 1
~ puts time1
You need to tell Ruby, that you want to change the variable explicitly.
A quote I cannot attribute: “Computers never do what they should, only
what you tell them to do”.
It might help if you put spaces between operators, as that helps in
catching errors. I am speaking from experience.
~ “That’s the whole problem with science. You’ve got a bunch of
~ empiricists trying to describe things of unimaginable wonder.”
~ — Calvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----