# Difference between "function foo()" and "foo = function()" syntax, confusing

**URL:** https://forum.kirupa.com/t/difference-between-function-foo-and-foo-function-syntax-confusing/114562
**Category:** Uncategorized
**Created:** [June 29, 2004, 7:03pm UTC](https://forum.kirupa.com/t/difference-between-function-foo-and-foo-function-syntax-confusing/114562 "2004-06-29T19:03:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![gyftus](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gyftus/32/617_2.png) [@gyftus](https://forum.kirupa.com/u/gyftus)
#### Post date: [June 29, 2004, 7:03pm UTC](https://forum.kirupa.com/t/difference-between-function-foo-and-foo-function-syntax-confusing/114562/1 "2004-06-29T19:03:07Z")

</div>

Hello all,

This might be a stupid question, but here it goes. I was following the tutorials by _senocular_ on trigonometry [http://www.kirupa.com/developer/actionscript/trigonometry.htm](http://www.kirupa.com/developer/actionscript/trigonometry.htm)  
and I was attempting to do my own simple 2d animation, using the mouse to determine the direction of the rotation.

I defined my functions in the following manner

```auto
function rotateCircle(){ ...} 
this.onEnterFrame = rotateCircle();

```

this cause _rotateCircle_ to run only once.

Now when I defined as

```auto
 rotateCircle = function(){...} 
this.onEnterFrame = rotateCircle;

```

The code will repeatedly run and I got the effect a wished checking the mouse position and so forth and so on.

Can somebody please tell what is the difference in the syntax  
and why the later gets repeated??

Thanks in advance
