#### Conditional multiplication
Let's start with a simple example using `multiply_by`:

```json
{
  "speed": [
    {
      "if": "road_class == MOTORWAY",
      "multiply_by": "0.5"
    }
  ]
}
```
This custom model reduces the speed of every road segment for which the `road_class` attribute is `MOTORWAY` to
fifty percent of the default speed (the default speed is multiplied by `0.5`). Again, the default speed is the speed
that GraphHopper would normally use for the profile's vehicle. Note the `if` clause which means that the operation
(`multiply_by`) is only applied *if* the condition `road_class == MOTORWAY` is fulfilled for the road segment under
consideration. The `==` indicates equality, i.e. the condition reads "the road_class equals MOTORWAY". If you're a bit
familiar with programming note that the condition (the value of the `if` key) is just a boolean condition in Java
language (other programming languages like C or JavaScript are very similar in this regard). A more complex condition
could look like this: `road_class == PRIMARY || road_class == TERTIARY` which uses the **or**
(`||`) operator and literally means "road_class equals PRIMARY or road_class equals TERTIARY".
There can be multiple such 'if statements' in the speed section, and they are evaluated from top to bottom:

```json
{
  "speed": [
    {
      "if": "road_class == MOTORWAY",
      "multiply_by": "0.5"
    },
    {
      "if": "road_class == PRIMARY || road_environment == TUNNEL",
      "multiply_by": "0.7"
    }
  ]
}
```
In this example the default speed of road segments with `road_class == MOTORWAY` will be multiplied by `0.5`, the default speed
of road segments with `road_class == PRIMARY` will be multiplied by `0.7` and for road segments with both `road_class == MOTORWAY` and
`road_environment == TUNNEL` the default speed will be multiplied first by `0.5` and then by `0.7`. So overall the
default speed will be multiplied by `0.35`. For road segments with `road_class == PRIMARY` and `road_environment == TUNNEL` we
only multiply by `0.7`, even though both parts of the second condition apply. It only matters whether the road segment matches
the condition or not.
`road_class` and `road_environment` are road attributes of 'enum' type, i.e. their value can only be one of a fixed set of
values, like `MOTORWAY` for `road_class`.
Other road attributes like `road_class_link` are of `boolean` type. They can be used as conditions directly, for example:

```json
{
  "speed": [
    {
      "if": "road_class_link",
      "multiply_by": "0.6"
    }
  ]
}
```
which means that for road segments with `road_class_link==true` the speed factor will be `0.6`.
For attributes with numeric values, like `max_width` you should not use the `==` (equality) or `!=` (
inequality) operators, but the numerical comparison operators "bigger" `>`, "bigger or equals" `>=`, "smaller" `<`, or
"smaller or equals" `<=`, e.g.:

```json
{
  "speed": [
    {
      "if": "max_width < 2.5",
      "multiply_by": "0.8"
    }
  ]
}
```
which means that for all road segments with `max_width` smaller than `2.5m` the speed is multiplied by `0.8`.
