Skip to content
Branch: master
Find file History
Latest commit f682128 May 6, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information. Update May 5, 2019 Folder structure and core bot sample for LG Apr 16, 2019 Add foreach doc (#1456) Apr 28, 2019

Common Expression Language [PREVIEW]

Bots, like any other application, require use of expressions to evaluate outcome of a condition based on runtime information available in memory or to the dialog or the language generation system.

Common expression language was put together to address this core need as well as to rationalize and snap to a common expression language that will be used across Bot Framework SDK and other conversational AI components that need an expression language.

See here for API reference.

An expression is a sequence that can contain one or more operators, variables, explicit values, pre-built functions or Language Generation templates.


Operator Functionality Prebuilt function equivalent
+ Arithmetic operator – addition. E.g. A + B add
- Arithmetic operator – subtraction. E.g. A – B sub
unary + Arithmetic operator – positive E.g. +1, +A -
unary - Arithmetic operator – negative value E.g. –2, -B -
* Arithmetic operator – multiplication. E.g. A * B mul
/ Arithmetic operator – division. E.g. A / B div
^ Arithmetic operator – exponentiation. E.g. A ^ B exp
% Arithmetic operator – modulus. E.g. A % B mod
== Comparison operator – equals. E.g. A == B equals
!= Comparison operator – Not equals. E.g. A != B not(equals())
> Comparison operator – Greater than. A > B greater
< Comparison operator – Less than. A < B less
>= Comparison operator – Greater than or equal. A >= B greaterOrEquals
<= Comparison operator – Less than or equal. A <= B lessOrEquals
& Concatenation operator. Operands will always be cast to string – E.g. A & B N/A
&& Logical operator – AND. E.g. exp1 && exp2 and
|| Logical operator – OR. E.g. exp1 || exp2 or
! Logical operator – NOT. E.g. !exp1 Not
' Used to wrap a string literal. E.g. 'myValue' N/A
" Used to wrap a string literal. E.g. "myValue" N/A
[] Used to denote a Template. E.g. [MyTemplate]. N/A
[] Used to refer to an item in a list by its index. E.g. A3 N/A
{} Used to denote an expression. E.g. {A == B}. N/A
{} Used to denote a variable in template expansion. E.g. {myVariable} N/A
() Enforces precedence order and groups sub expressions into larger expressions. E.g. (A+B)*C N/A
. Property selector. E.g. myObject.Property1 N/A
@{} Used to denote parts of a multi-line value that requires evaluation N/A
\ Escape character for templates, expressions. N/A
@entityName Short hand notation that expands to turn.entities.entityName N/A
$propertyName Short hand notation that expands to N/A
#intentName Short hand notation that expands to turn.intents.intentName N/A


Variables are always referenced by their name. E.g. {myVariable} Variables can be complex objects. In which case they are referenced either using the property selector operator e.g. myParent.myVariable or using the item index selection operator. E.g. myParent.myList[0]. or using the parameters function.

Explicit values

Explicit values are enclosed in single quotes 'myExplicitValut' or double quotes - "myExplicitValue".

Pre-built functions

See Here for a complete list of prebuilt functions supported by the common expression language library.


Packages for C# are available under the BotBuidler MyGet feed

You can’t perform that action at this time.