# Kakscript: boolean / string / error equality testing

**URL:** <https://discuss.kakoune.com/t/kakscript-boolean-string-error-equality-testing/1959>\
**Category:** Resources\
**Tags:** scripting\
**Created:** [December 15, 2021, 1:07pm UTC](https://discuss.kakoune.com/t/kakscript-boolean-string-error-equality-testing/1959 "2021-12-15T13:07:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![almr](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/almr/32/934_2.png) [@almr](https://discuss.kakoune.com/u/almr)\
**Post date:** [December 15, 2021, 1:30pm UTC](https://discuss.kakoune.com/t/kakscript-boolean-string-error-equality-testing/1959/2 "2021-12-15T13:30:41Z")

</div>

A quick note: I think this mostly supersedes @andreyorst 's [if-then-else technique](https://discuss.kakoune.com/t/if-else-control-flow-operator/571), because

```auto
def some-function-using-if_then_else -params 3 %{
try %{
  "mypkg-str-literal-true-%arg{1}"
  # IF PART
  echo -debug %arg{2}
} catch %{
  # ELSE PART
  echo -debug %arg{3}
}
}

```

can evaluate its arguments. If- and else- strings, OTOH, if passed to an `if` function, would be evaluated in _that_ function’s context, so `%arg`'s would be nonsense — and access to the original args would need to be arranged via saving them in an option.

---

_[View the full topic](https://discuss.kakoune.com/t/kakscript-boolean-string-error-equality-testing/1959)._
