A Qore program is composed of a series of declarations, statements, function definitions, and/or class definitions. Non-\/block statements are terminated by a semi-\/colon \char`\"{};\char`\"{}. Block statements are grouped by using curly brackets (\char`\"{}\{\char`\"{} and \char`\"{}\}\char`\"{}), as in C, C++, Java, and Perl.

Programmers familiar with C, C++, Java, and/or Perl should find the standard Qore syntax intuitive and should be productive fairly quickly with the language. However Qore has unique features that differentiate it from other languages, and these features must be mastered in order to leverage the full power of Qore.

Qore programs/scripts are free form. Formatting does not affect the execution of the program; formatting is at the discretion of the programmer and should be used to enhance readability and clarity of the source code.

Qore was created as a weakly typed language. That means that \mbox{\hyperlink{variables}{variables}} (without type restrictions) can hold values of any type and functions (without a return type restriction or parameter type descriptions) can return any data type and take arguments of any type. Furthermore list elements can be of any type (they do not have to be uniform), and multidimensional lists can have a different number of elements in each list. The same type flexibility holds true of hashes, objects, and all combinations of container types.

Qore also allows variable, parameter, class member, and return types to be declared, so that A\+P\+Is can be formally defined or the programmer can decide to declare types to catch more errors at parse time (which is often preferable to discovering a type error at runtime).

Qore can be used as a traditional function-\/based scripting language or as a pure object-\/oriented language, where the application is defined as a class. Aside from traditional local and global variables, constants, and functions, Qore also supports nested \mbox{\hyperlink{qore_namespaces}{namespaces}}, \mbox{\hyperlink{qore_classes}{classes}}, \mbox{\hyperlink{qore_classes_inheritance}{multiple inheritance}}, overriding base class constructor arguments, public and private \mbox{\hyperlink{qore_classes_class_members}{members}} and \mbox{\hyperlink{qore_classes_class_methods}{methods}}, \mbox{\hyperlink{qore_classes_static_methods}{static class methods}}, and \mbox{\hyperlink{qore_classes_static_class_variables}{static class variables}}.

All elements of Qore are designed to work together\+: \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{database access}}, \mbox{\hyperlink{class_qore_1_1_socket}{socket communication}}, \mbox{\hyperlink{class_qore_1_1_program}{embedding logic in subprograms}}, \mbox{\hyperlink{qore_regex}{regular expressions}}, \mbox{\hyperlink{operators}{operators}}, \mbox{\hyperlink{qore_functions}{functions}}, and all other elements are thread-\/safe and built on an execution engine that was designed for S\+MP scalability.

Qore automatically converts data types when necessary when evaluating operators. The goal is to provide the expected result for the programmer without requiring the programmer to explicitly convert data types. Please see \mbox{\hyperlink{operators}{Operators}} for more information.

Qore supports \mbox{\hyperlink{signal_handling}{signal handling}} by executing Qore-\/language signal handlers in special \mbox{\hyperlink{signal_handling}{signal-\/handling thread}}.

U\+N\+IX operating systems allow an executable script to specify their interpreter. This is done by setting the first line of the script to a special string indicating the location of the interpreter (Qore binary). For the purposes of this document, the location for the {\ttfamily qore} binary is assumed to be {\ttfamily /usr/bin/qore}. The first line of Qore scripts in this case should look as follows\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{\#!/usr/bin/qore}}
\end{DoxyCode}


Qore is moving toward establishing \mbox{\hyperlink{parse_directives_new-style}{\%new-\/style}} as the default syntax; all examples given in the Qore documentation are given assuming \mbox{\hyperlink{parse_directives_new-style}{\%new-\/style}}. To use Qore with the recommended \mbox{\hyperlink{parse_directives}{parse directives}}, the following can be used as an example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{\#!/usr/bin/qore}}
\DoxyCodeLine{\%new-style}
\DoxyCodeLine{\%strict-args}
\DoxyCodeLine{\%require-types}
\DoxyCodeLine{\%enable-all-warnings}
\end{DoxyCode}


\begin{DoxyNote}{Note}
If another installation directory is used (such as {\ttfamily /usr/local/bin}), then the correct path must be reflected in the first line of the Qore script (ex\+: {\ttfamily \#!/usr/local/bin/qore}), or more portably without using a direct path to the interpreter\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{\#!/usr/bin/env qore}}
\end{DoxyCode}
 This form will work as long as the {\ttfamily qore} binary is in the current {\ttfamily P\+A\+TH}.
\end{DoxyNote}
Qore convention dictates that Qore script file names end with {\ttfamily \char`\"{}.\+q\char`\"{}}; \mbox{\hyperlink{qore_modules_user_modules}{user modules}} with {\ttfamily \char`\"{}.\+qm\char`\"{}}, and \href{../../modules/QUnit/html/index.html}{\texttt{ test scripts}} with {\ttfamily \char`\"{}.\+qtest\char`\"{}}. 