# Function arguments not initializing variable inside the body

**URL:** <https://verificationacademy.com/forums/t/function-arguments-not-initializing-variable-inside-the-body/31889>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, functions-in-system-verilog\
**Created:** [June 2, 2016, 6:53pm UTC](https://verificationacademy.com/forums/t/function-arguments-not-initializing-variable-inside-the-body/31889 "2016-06-02T18:53:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![sriram.seshagiri](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sriram.seshagiri](https://verificationacademy.com/forums/u/sriram.seshagiri)\
**Post date:** [March 7, 2019, 7:18am UTC](https://verificationacademy.com/forums/t/function-arguments-not-initializing-variable-inside-the-body/31889/3 "2019-03-07T07:18:03Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/function-arguments-not-initializing-variable-inside-the-body/31889/2):_

Hi Dave,

I had a question. Agreed we need to declare the function as Automatic. But, for this simple example if the code was modified to this below. this would still work right. For cerain applications like Recursion, etc then yes the Function has to be declare Automatic if it is inside a module.

```verilog
function int divide(int dividend, int divisor);
    int i;
    i = dividend / divisor; // MOVED TO NEW LINE
    return i;
  endfunction

```

---

_[View the full topic](https://verificationacademy.com/forums/t/function-arguments-not-initializing-variable-inside-the-body/31889)._
