> For the complete documentation index, see [llms.txt](https://docs.wem.io/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wem.io/platform/tutorials/building-widgets/wemscript/8-types/2-concept.md).

# 2. Concept

The concept is a special kind of type. The values of a concept are not known within the context of a widget. However, if you create a generic widget, you don't need to know them. Let’s take a look at the following WEMscript to illustrate this.

Throughout the examples, we will assume we have a concept data model property called `ConceptProperty`.

```wemscript
var @c: concept

/* Assign @c with the concept value that is inside the property @ConceptProperty */
@c := @ConceptProperty

/* This will throw an error: 'Colors'.'Red' is an unknown concept in the context of a widget */
@c := 'Colors'.'Red'

/* Executing concept-specific functions is allowed */
var @d := Description(@Color)
var @s := ToString(@Color)
var @i := ConceptId(@ConceptProperty)
```

Notice that everything works except for the assignment of the `'Colors'.'Red'` concept literal, which is unknown in the context of a widget and only recognized within a project. To assign a concept data model property a new value, we use arbitrary IDs by calling the `ConceptId()` function. Fortunately, these IDs are just integers and can be easily passed around in the code.

Now, let’s look at the following dropdown example widget that uses a range of concepts to set the `@ConceptProperty`:

#### Dropdown Concept Selector

```html
<? register input @ConceptProperty ?>
<select name="<?attr OutputId(@ConceptProperty) ?>">
<? loop range of @ConceptProperty ?>
	<option value="<?attr ConceptId(concept) ?>" <? if concept = @ConceptProperty ?>selected<? end ?>>
		<?= concept ?>
	</option>
<? end ?>
</select>
```

In the above example, we have created a writable concept data model property called `@ConceptProperty`. The context of this concept is unknown to us; it could represent a range of colors, animals, or the status of a ticket. However, in this case, we do not need to know the specific context. We obtain the range of `@ConceptProperty` using the `range of` keyword and enumerate through it with the `loop`. We create the `<option>` elements where the values are generated using the `ConceptId(concept)` function, with `concept` being a special keyword that refers to the current enumerated concept within the range of `@ConceptProperty`. By comparing `concept` with `@ConceptProperty`, we can determine if the latter holds the value of `concept`, allowing us to select the appropriate option.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wem.io/platform/tutorials/building-widgets/wemscript/8-types/2-concept.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
