Thursday, April 8, 2010

Difference between "and" and "&&"

klasses = ['last'] && txt = '' if idx == (tabs.length - 1)


At the end of this statement klasses will contain "".

klasses = ['last'] and txt = '' if idx == (tabs.length - 1)


At the end of this statement klasses will contain ['last'] which was what I intended. But the first statement wasn't returning that.

A good explanation is here http://stackoverflow.com/questions/1426826/difference-between-and-and-in-ruby

35 comments:

WilburC_Custis said...

It's great!!..........................................

ToryB_He231147 said...

It's great!!..................................................

AronArendt0418 said...

hello~welcome my world~<. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

RexTemples20144 said...

文章很棒~感謝!!..................................................

文君 said...

Of two evils choose the least.......................................................

韋于倫成 said...

累死了…來去看看文章轉換心情~..................................................

火吟 said...

nice to meet you~.................................................................

健豪 said...

Lets cross the bridge when we come to it..................................................

紫倫妍勳 said...

加油!充實內函最重要!Beauty is but skin- deep...................................................

ShilaLong嘉雯 said...

聰明的人喜歡猜心 雖然每次都猜對了卻失去了自己的心..................................................

明英 said...

婚姻對男人來說是賭他的自由,對女人而言卻是賭她的幸福。..................................................................

黃佳伸 said...

Keep in contact. Good Luck..................................................

江婷 said...

一個人的價值,應該看他貢獻了什麼,而不是他取得了什麼.................................................................                           

江婷 said...

Quality is better than quantity.................................................................

貴寶 said...

向著星球長驅直進的人,反比踟躕在峽路上的人,更容易達到目的。............................................................

江冠彭珮李佳宏陽筠 said...

當一個人內心能容納兩樣相互衝突的東西,這個人便開始變得有價值了。............................................................

ToryO_Viss鈺雯er0316 said...

朋友是一面鏡子............................................................

ju吳phe宇te佳ns said...

單純喜歡你的部落格 留個言跟您問聲好~~............................................................

陳韋夏陳韋夏益東富益東富 said...

文章雖然普通,但意義卻很大~~^^~~ ..................................................................

婷珊 said...

河水永遠是相同的,可是每一剎那又都是新的。

亦妮亦妮 said...

卡爾.桑得柏:「除非先有夢,否則一切皆不成。」共勉!..................................................................

冠宇 said...

要持續更新下去喲!!祝你心情愉快..................................................................

淑慧 said...

這麼用心的經營你的文章, 當然值得我們留連拜訪的!..................................................................

士凱士凱 said...

缺少智慧,就是缺少一切..................................................

劉士賢劉士賢 said...

時間就是塑造生命的材料。

楊燕沛楊燕沛 said...

你不能改變容貌~~但你可以展現笑容.................................................................

吳許芝蓮佩儒 said...

良言一句三冬暖,惡語傷人六月寒。......................................................................

玄王季玄王季玄王季 said...

不錯的資訊~我會好好記下來!............................................................

文王廷 said...

愛,拆開來是心和受兩個字。用心去接受對方的一切,用心去愛對方的所有。......................................................................

靜蔡蔡蔡蔡怡 said...

人不能像動物一樣活著,而應該追求知識和美德............................................................

淑芳 said...

讓好心情回味發酵;壞心情留在文字裡隨時間消逝吧!............................................................

瑰潼 said...

愛情是盲目的,但婚姻恢復了它的視力。......................................................................

阮艳 said...

聰明人之所以不會成功,是因為他們缺乏了堅忍的毅力。.................................................

方峻君 said...

人生中最好的禮物就是屬於自己的一部份............................. ....................................

張王雅竹欣虹 said...

一個人的際遇在第一次總是最深刻的,有時候甚至會讓人的心變成永遠的絕緣。......................................................................