# Type declarations

**URL:** <https://forum.kirupa.com/t/type-declarations/281272>\
**Category:** flash\
**Created:** [February 6, 2009, 6:52pm UTC](https://forum.kirupa.com/t/type-declarations/281272 "2009-02-06T18:52:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikomax](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nikomax/32/3664_2.png) [@nikomax](https://forum.kirupa.com/u/nikomax)\
**Post date:** [February 6, 2009, 6:52pm UTC](https://forum.kirupa.com/t/type-declarations/281272/1 "2009-02-06T18:52:59Z")

</div>

I have been learning Java for my uni course and to me it seems that AS3 is similar to it in a few ways.

But how strict is the type definition in AS3? For those of you that don’t understand here is an example.

JAVA

```auto

Boolean _myVar = false;

public Boolean myFunction(){
    return _myVar;
}

```

AS3

```auto

var _myVar:Boolean = false;

public myFunction():Boolean{
    return _myVar;
}

```

You can’t compile Java code with out the types defined for variables and the return type defined for functions.

However in AS3 I seem to be able to miss out these type definitions without out any difference being made or even half-heartedly do it leading to messy looking code.

So do I really need to use type declarations all the time or is it there just for my piece of mind?
