# 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.
