# Variable not globally nested, variable cannot be applied with if func

**URL:** <https://discourse.gohugo.io/t/variable-not-globally-nested-variable-cannot-be-applied-with-if-func/13449>\
**Category:** support\
**Created:** [August 8, 2018, 2:54pm UTC](https://discourse.gohugo.io/t/variable-not-globally-nested-variable-cannot-be-applied-with-if-func/13449 "2018-08-08T14:54:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [August 9, 2018, 2:31am UTC](https://discourse.gohugo.io/t/variable-not-globally-nested-variable-cannot-be-applied-with-if-func/13449/2 "2018-08-09T02:31:40Z")

</div>

> [@onlinemantas](#):
>
> Why is $lang not globally nested?

It’s a Go thing: [Hugo + Go 1.11 hype thread](https://discourse.gohugo.io/t/hugo-go-1-11-hype-thread/13198)

This recent post might help: [Scoping a variable outside of and if statement (or two)](https://discourse.gohugo.io/t/solved-scoping-a-variable-outside-of-and-if-statement-or-two/13229)

For now you will have to use `.Scratch` [Scratch | Hugo](https://gohugo.io/functions/scratch/)

---

_[View the full topic](https://discourse.gohugo.io/t/variable-not-globally-nested-variable-cannot-be-applied-with-if-func/13449)._
