- See more at: http://blogtimenow.com/blogging/automatically-redirect-blogger-blog-another-blog-website/#sthash.YsVbCxL0.dpuf Journey to Becoming a Web Developer: | |= and &&=

Sunday, December 15, 2013

| |= and &&=

I decided to post on the | |=(or equals) because I saw it recently in another student's code and I had never seen it before. Here is an example:

Line 2 is saying that if a is nil set it to 9. Now a becomes 9. Line 3 is saying that if a is nil set it to 6 since a is now 9 nothing is done. Another one I stumbled upon when researching | |= is &&=. &&= is the opposite of | |=. Here is an example:

Line 2 is saying that if a is not nil set it to nil. In this case a becomes nil.  Line 3 is saying that if a is not nil set it to 25. Because a is nil nothing is done. 

No comments:

Post a Comment