Browse by Tags

C style comments and keyword GO in T-SQL
Published 06-30-2005 6:57 PM | jokiz
I've just encountered a weird error caused by a GO keyword lost inside a commented block using C style comment (/* */). My hunch is that the GO keyword (which is normally on a separate line) is treated differently by T-SQL parser. I will research on this...
Filed under: ,
The (-) operator
Published 04-28-2005 6:32 PM | jokiz
I used to multiply a numeric number to -1 just to get its additive inverse (negative value for positive numbers) and I found out that the (-) operator does it implicitly. int value = 10 int negativeValue = value * -1 int negativeValueAlso = -value
Filed under: , , ,
Efficient For Loop
Published 03-17-2005 7:13 PM | jokiz
[code language="C#"] for (int i = 0; i < collection.Count; i++) { //do something with collection } [/code] I’ve done this before and for me, the efficient way is to store the Count property of the collection rather than access it everytime for the...
Filed under: , , ,
Assignment in a WHILE condition
Published 01-17-2005 5:34 PM | jokiz
Before, I used to think that in C, the assignment operator always evaluate to true. It is because of this context: [code language="C#"] while (intLeft == intRight) { //do whatever } [/code] If you mistyped the comparison operator (==) as a single equal...
Filed under: , , ,