domingo, 11 de agosto de 2013

What does “shadowing” mean in Ruby?


Shadowing is when you have two different local variables with the same name. It is said that the variable defined in the inner scope "shadows" the one in the outer scope (because the outer variable is now no longer accessible as long as the inner variable is in scope, even though it would otherwise be in scope).

So in your case, you can't access the outer x variable in your block, because you have an inner variable with the same name.

Running ruby with the option -w will warn you about shadowing.

viernes, 9 de agosto de 2013

Little bits of knowledge I(false and nil)

 Little bits of knowledge I(false and nil)

Along with false, nil is one of two non-true values in Ruby. (Every other object is regarded as "truthy," meaning that if you were to type if 2 or if "bacon", the code in that if statement would be run.)

It's important to realize that false and nil are not the same thing: false means "not true," while nil is Ruby's way of saying "nothing at all."

variables that start with colons are symbols. symbols aren't strings
while there can be multiple different strings that all have the same value, there's only one copy of any particular symbol at a given time.

martes, 6 de agosto de 2013

I keep forgetting the git basic commands...

I keep forgetting the git basic commands...

Local:

>>git status
It tell us the status of the files on the directory(modified, pending to commit, ...)
>>git commit - m "my first entry in this blog"
Assigns the commit state to the modified files

From local to the internet:
>>git push origin master
With this command we are pushing things that have been committed to the origin(github) from the master(branch)