Using the ?: operator as opposed to if…else…
Question: Is there a problem with using the ?: operator instead of the if…else… construct? For example, see the following: if(iNum1 > iNum2) iNum3 = iNum1;else iNum3 = iNum2; The
Question: Is there a problem with using the ?: operator instead of the if…else… construct? For example, see the following: if(iNum1 > iNum2) iNum3 = iNum1;else iNum3 = iNum2; The
Question: How do I pass a function as a parameter? Answer: First, let’s distinguish between a parameter and an argument. The parameter is the type of the object passed. An
Question: How do you make the compiler generate an error when a variable is set to a value outide the range of the constrained type? For example; strong x; //strong
Most API function that return a string require that you pass a buffer where they can place the result as a null-terminated ANSI string (a.k.a. ASCIIZ string). The calling code
You can often use the Replace function in a smewhat unorthodox ways to simplify (and sometimes optimize) your code. For example, in order to count the number of occurrences of
I find the Replace function very useful when I want to avoid too many append operations just to insert non-printable characters. For example, the following statement: MsgBox “Disk not ready.”
Visual Basic doesn’t provide any way to declare an array and initialize its elements at the same time. In most cases you end up with setting individual elements one by
To determine whether a String array contains a given item it seems that you can’t avoid writing a loop. However, you can do it with just one line of code,
Question: How do I convert an integer/float type into a string? Answer: Converting numbers to strings is much easier than you think. Because JavaScript is an untyped language, the interpreter