# static functions, does the implicit return variable get overwritten by exp in return exp;?

**URL:** <https://verificationacademy.com/forums/t/static-functions-does-the-implicit-return-variable-get-overwritten-by-exp-in-return-exp/51769>\
**Category:** SystemVerilog\
**Created:** [October 28, 2026, 7:50pm UTC](https://verificationacademy.com/forums/t/static-functions-does-the-implicit-return-variable-get-overwritten-by-exp-in-return-exp/51769 "2026-10-28T19:50:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rika\_furude](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/8edcca/32.png) [@rika\_furude](https://verificationacademy.com/forums/u/rika_furude)\
**Post date:** [October 28, 2026, 7:50pm UTC](https://verificationacademy.com/forums/t/static-functions-does-the-implicit-return-variable-get-overwritten-by-exp-in-return-exp/51769/1 "2026-10-28T19:50:30Z")

</div>

Hi, the LRM says at 13.4.1

“The return statement shall override any value assigned to the function name.”

However, it is not clear whether the implicit static return variable declared by static function is overwritten by the expression in the return statement. For example

function int foo(int init){  
if (init)  
foo = 0;  
else  
return foo + 1;  
}

suppose we call foo(1), foo(0), foo(0), foo(0)…

does the LRM say we get 0, 1, 1, 1… or 0, 1, 2, 3…?

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [October 29, 2026, 11:08am UTC](https://verificationacademy.com/forums/t/static-functions-does-the-implicit-return-variable-get-overwritten-by-exp-in-return-exp/51769/2 "2026-10-29T11:08:40Z")

</div>

Since the `return` statement is an enhancement to Verilog; I see that all tools treat it as a shortcut for assigning to the implicit return variable and exiting the function.
