Questions tagged [keyword]

Keywords are special words used as identifiers by a language. They are reserved words accepted by a compiler or interpreter, and thus should not (or cannot) be used as a variable or function name.

Keywords are special words used as identifiers by a language. They are reserved words accepted by a compiler or interpreter, and thus can't be used as a variable or function name. SELECT, for example, is a keyword in SQL, so running an SQL query on a table named SELECT is likely to raise fatal errors.

Often languages provide a method for "escaping" keywords to allow their usage -- for example, the quotation marks in the statement SELECT PERSON_ID FROM "SELECT". But the use of keywords is typically considered bad practice even when a method like this is provided.

The term Keyword is also used as a synonym for "search term". For that meaning, you should use a different tag such as .

2442 questions
19 answers

What is the purpose of the var keyword and when should I use it (or omit it)?

NOTE: This question was asked from the viewpoint of ECMAScript version 3 or 5. The answers might become outdated with the introduction of new features in the release of ECMAScript 6. What exactly is the function of the var keyword in JavaScript,…
  • 75,813
  • 86
  • 255
  • 348
17 answers

What does 'synchronized' mean?

I have some questions regarding the usage and significance of the synchronized keyword. What is the significance of the synchronized keyword? When should methods be synchronized? What does it mean programmatically and logically?
  • 27,036
  • 42
  • 89
  • 117
28 answers

What's the difference between the 'ref' and 'out' keywords?

I'm creating a function where I need to pass an object so that it can be modified by the function. What is the difference between: public void myFunction(ref MyClass someClass) and public void myFunction(out MyClass someClass) Which should I use…
  • 46,577
  • 46
  • 119
  • 147
25 answers

What is the volatile keyword useful for?

At work today, I came across the volatile keyword in Java. Not being very familiar with it, I found this explanation. Given the detail in which that article explains the keyword in question, do you ever use it or could you ever see a case in which…
  • 9,972
  • 4
  • 26
  • 32
6 answers

Difference of keywords 'typename' and 'class' in templates?

For templates I have seen both declarations: template < typename T > template < class T > What's the difference? And what exactly do those keywords mean in the following example (taken from the German Wikipedia article about templates)? template <…
  • 11,263
  • 10
  • 45
  • 48
8 answers

Equivalent of "continue" in Ruby

In C and many other languages, there is a continue keyword that, when used inside of a loop, jumps to the next iteration of the loop. Is there any equivalent of this continue keyword in Ruby?
Mark Szymanski
  • 56,590
  • 24
  • 70
  • 87
18 answers

Does the 'mutable' keyword have any purpose other than allowing a data member to be modified by a const member function?

A while ago, I came across some code that marked a data member of a class with the mutable keyword. As far as I can see it simply allows you to modify a member in a const-qualified member method: class Foo { private: mutable bool done_; …
  • 76,700
  • 56
  • 158
  • 197
10 answers

What is the native keyword in Java for?

While playing this puzzle (It's a Java keyword trivia game), I came across the native keyword. What is the native keyword in Java used for?
  • 16,044
  • 17
  • 67
  • 98
17 answers

What is the difference between the "const" and "final" keywords in Dart?

What is the difference between the const and final keywords in Dart?
Ishmal Ijaz
  • 5,317
  • 3
  • 11
  • 17
4 answers

Passing a dictionary to a function as keyword parameters

I'd like to call a function in python using a dictionary with matching key-value pairs for the parameters. Here is some code: d = dict(param='test') def f(param): print(param) f(d) This prints {'param': 'test'} but I'd like it to just print…
Dave Hillier
  • 18,105
  • 9
  • 43
  • 87
8 answers

What does PHP keyword 'var' do?

This is probably a very trivial question, but I haven't been able to find the answer neither through web search engines, nor on Please just direct me to where I can read about this, if you haven't got time to explain. What does the 'var'…
  • 4,869
  • 3
  • 21
  • 17
16 answers

What is the "some" keyword in Swift(UI)?

The new SwiftUI tutorial has the following code: struct ContentView: View { var body: some View { Text("Hello World") } } The second line the word some, and on their site is highlighted as if it were a keyword. Swift 5.1 does not…
  • 5,078
  • 2
  • 10
  • 20
12 answers

When should I use the new keyword in C++?

I've been using C++ for a short while, and I've been wondering about the new keyword. Simply, should I be using it, or not? With the new keyword... MyClass* myClass = new MyClass(); myClass->MyField = "Hello world!"; Without the new…
Nick Bolton
  • 38,276
  • 70
  • 174
  • 242
7 answers

Understanding implicit in Scala

I was making my way through the Scala playframework tutorial and I came across this snippet of code which had me puzzled: def newTask = Action { implicit request => taskForm.bindFromRequest.fold( errors =>…
  • 3,991
  • 3
  • 17
  • 15
10 answers

Normal arguments vs. keyword arguments

How are "keyword arguments" different from regular arguments? Can't all arguments be passed as name=value instead of using positional syntax?
  • 25,873
  • 32
  • 98
  • 137
2 3
99 100