def METHOD_NAME(self, val, var=None):
    r"""Sets an experimental variable.
    Parameters
    ----------
    val    A value.
    var : str, unicode, NoneType, optional
        A variable name, or None to use widget default.
    """
    if var is None:
        var = self.var
    if var is None:
        return
    if isinstance(val, bool):
        val = 'yes' if val else 'no'
    self.form.experiment.var.set(
        self.form.experiment.syntax.eval_text(var), val)