What is the difference between “keyword” and “reserved word”?

Keywords have a special meaning in a language, and are part of the syntax. Reserved words are words that cannot be used as identifiers (variables, functions, etc.), because they are reserved by the language. In practice most keywords are reserved words and vice versa. But because they’re two different things it may happen that a … Read more

Equivalent of “pass” in Ruby

No, there is no such thing in Ruby. If you want an empty block, method, module, class etc., just write an empty block: def some_method end That’s it. In Python, every block is required to contain at least one statement, that’s why you need a “fake” no-op statement. Ruby doesn’t have statements, it only has … Read more

What’s the point of “As” keyword in C#

They aren’t two system of casting. The two have similar actions but very different meanings. An “as” means “I think this object might actually be of this other type; give me null if it isn’t.” A cast means one of two things: I know for sure that this object actually is of this other type. … Read more

When should one use dynamic keyword in c# 4.0?

Dynamic should be used only when not using it is painful. Like in MS Office libraries. In all other cases it should be avoided as compile type checking is beneficial. Following are the good situation of using dynamic. Calling javascript method from Silverlight. COM interop. Maybe reading Xml, Json without creating custom classes.

Python, why elif keyword? [closed]

Far as I know, it’s there to avoid excessive indentation. You could write if x < 0: print ‘Negative’ else: if x == 0: print ‘Zero’ else: print ‘Positive’ but if x < 0: print ‘Negative’ elif x == 0: print ‘Zero’ else: print ‘Positive’ is just so much nicer. Thanks to ign for the … Read more

Why would you use the keyword const if you already know variable should be constant?

Apart from specifying to readers of the code that you may cause errors if you modify this variable(you can use comments to do this) Not “may”; will cause errors in your program. A C++ compiler will enforce it with compilation failures and diagnostic messages (“compiler errors”), with no need for comments; A C compiler will … Read more

Is `id` a keyword in python?

id is not a keyword in Python, but it is the name of a built-in function. The keywords are: and del from not while as elif global or with assert else if pass yield break except import print class exec in raise continue finally is return def for lambda try Keywords are invalid variable names. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)