# `EEx.SmartEngine`
[🔗](https://github.com/elixir-lang/elixir/blob/7ff272706afc522e74121493b7166719985cb099/lib/eex/lib/eex/smart_engine.ex#L5)

The default engine used by EEx.

It includes assigns (like `@foo`) and possibly other
conveniences in the future.

## Examples

    iex> EEx.eval_string("<%= @foo %>", assigns: [foo: 1])
    "1"

In the example above, we can access the value `foo` under
the binding `assigns` using `@foo`. This is useful because
a template, after being compiled, can receive different
assigns and would not require recompilation for each
variable set.

Assigns can also be used when compiled to a function:

    # sample.eex
    <%= @a + @b %>

    # sample.ex
    defmodule Sample do
      require EEx
      EEx.function_from_file(:def, :sample, "sample.eex", [:assigns])
    end

    # iex
    Sample.sample(a: 1, b: 2)
    #=> "3"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
