# A question about functions using void

**URL:** <https://community.freefem.org/t/a-question-about-functions-using-void/2148>\
**Category:** General Discussion\
**Created:** [November 29, 2022, 7:38pm UTC](https://community.freefem.org/t/a-question-about-functions-using-void/2148 "2022-11-29T19:38:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![m31phy](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/m31phy/32/1216_2.png) [@m31phy](https://community.freefem.org/u/m31phy)\
**Post date:** [November 29, 2022, 7:38pm UTC](https://community.freefem.org/t/a-question-about-functions-using-void/2148/1 "2022-11-29T19:38:41Z")

</div>

Dear all

I have a question about functions in FreeFEM. Is it possible to use “void” type functions in FreeFEM?

Because my FreeFEM scripts have become long, I want to modulize my codes for maintenance.

But, when I looked at official FreeFEM documents, it seemed that there is no way to use the void type function.

So, if the void type function can not be used in FreeFem, how do you modulize your code?

Thank you

Sincerely

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 29, 2022, 9:48pm UTC](https://community.freefem.org/t/a-question-about-functions-using-void/2148/2 "2022-11-29T21:48:18Z")

</div>

What do you mean by modulize? How being able to use the type void would do a better job than what you have access to now?

---

<div class="post-metadata">

**Author:** ![m31phy](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/m31phy/32/1216_2.png) [@m31phy](https://community.freefem.org/u/m31phy)\
**Post date:** [November 30, 2022, 9:41pm UTC](https://community.freefem.org/t/a-question-about-functions-using-void/2148/3 "2022-11-30T21:41:57Z")

</div>

Hi. So, in my code, there is a “for” loop to solve time-dependent differential equations.

In the for loop, there are more than 50 lines for different commands. Due to the long lines, it seemed messy when I checked my code.

So, I want to call these commands or functions in the below way;

For instance, if it is written like C++ or C,

```auto
for (int i = 1; i < iteration; i++){
    function1();
    function2();
    function3();
}
...
void function1(void){
     <command lines>
}
void function2(void){
     <command lines>
}

```

But, I am not sure how I can do this in FreeFEM code

Thanks

---

<div class="post-metadata">

**Author:** ![aszaboa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aszaboa/32/2918_2.png) [@aszaboa](https://community.freefem.org/u/aszaboa)\
**Post date:** [November 30, 2022, 9:44pm UTC](https://community.freefem.org/t/a-question-about-functions-using-void/2148/4 "2022-11-30T21:44:09Z")

</div>

I think you can achieve what you want by using macros. Check the documentation for more info.

---

<div class="post-metadata">

**Author:** ![m31phy](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/m31phy/32/1216_2.png) [@m31phy](https://community.freefem.org/u/m31phy)\
**Post date:** [December 2, 2022, 6:57am UTC](https://community.freefem.org/t/a-question-about-functions-using-void/2148/5 "2022-12-02T06:57:00Z")

</div>

Thanks a lot! It would work!
