# Needs endforeach() a lable with older cmake version?

**URL:** https://discourse.cmake.org/t/needs-endforeach-a-lable-with-older-cmake-version/2442
**Category:** Usage
**Created:** [December 29, 2020, 2:49pm UTC](https://discourse.cmake.org/t/needs-endforeach-a-lable-with-older-cmake-version/2442 "2020-12-29T14:49:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [December 29, 2020, 2:49pm UTC](https://discourse.cmake.org/t/needs-endforeach-a-lable-with-older-cmake-version/2442/1 "2020-12-29T14:49:09Z")

</div>

> Removing the arguments from `endforeach()` and `endfunction()` will not work with older versions of CMake, they were only made optional in CMake 3.14.

Is that true?

---

<div class="post-metadata">

### Author: ![robert.maynard](https://discourse.cmake.org/user_avatar/discourse.cmake.org/robert.maynard/32/4_2.png) [@robert.maynard](https://discourse.cmake.org/u/robert.maynard)
#### Post date: [December 29, 2020, 4:05pm UTC](https://discourse.cmake.org/t/needs-endforeach-a-lable-with-older-cmake-version/2442/2 "2020-12-29T16:05:07Z")

</div>

No, that was when the documentation was updated to make it explicitly clear that the argument is optional.

The argument became optional in CMake 2.6, and not having one is recommend best practise ( [https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#isnt-the-expression-in-the-elseexpression-confusing](https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#isnt-the-expression-in-the-elseexpression-confusing) )
