Ah...... logic...
So this is a follow up to my previous post about the logical nature of VB (heh)... this example is really cool:
foo = 1
bar = 2
if foo and bar then
do something
end if
Question: Will you enter the if statement?
Answer: Absolutely not. Because 0x0001 and 0x0010 evaluates to 0x0000 which is hrm.... not true.
The correct form would be
if foo <> 0 and bar <> 0 then
do something cool
end if
And in other news the very last corner of the Sandwich I am almost done consuming has a small speck of mold on it. This disturbs me, luckily this was the last of the loaf anyway.
foo = 1
bar = 2
if foo and bar then
do something
end if
Question: Will you enter the if statement?
Answer: Absolutely not. Because 0x0001 and 0x0010 evaluates to 0x0000 which is hrm.... not true.
The correct form would be
if foo <> 0 and bar <> 0 then
do something cool
end if
And in other news the very last corner of the Sandwich I am almost done consuming has a small speck of mold on it. This disturbs me, luckily this was the last of the loaf anyway.
2 Comments:
Darth Bryan: I detect a great disturbance in the sandwich...
Bread is the path to the moldy side. Bread leads to staleness. Staleness leads to mold. Mold leads to suffering. I sense much bread in you.
Post a Comment
<< Home