Sign in to follow this  
Followers 0

CHALLENGE: thought efficiency

1 post in this topic

So.... I'm noob, so I'll use simple stuff.

By the way, I'm using the ruby programming language

a = 1

a = a+1

now what I did was to add the value of 1 to the variable "a", then a would be equal to a+1. So a = 2 or a = a+1

a = 1
a += 1

This is much more efficient than a = a+1, and less confusing. Sometimes the a = a+1 seems to be a paradox.

Anybody got examples of programming efficiency that a noob like me can understand?


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0