# Calling constructor in condition: A function call on a non-function was attempted

**URL:** <https://forum.kirupa.com/t/calling-constructor-in-condition-a-function-call-on-a-non-function-was-attempted/219001>\
**Category:** Uncategorized\
**Created:** [March 13, 2007, 2:04am UTC](https://forum.kirupa.com/t/calling-constructor-in-condition-a-function-call-on-a-non-function-was-attempted/219001 "2007-03-13T02:04:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poco](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@Poco](https://forum.kirupa.com/u/Poco)\
**Post date:** [March 13, 2007, 2:04am UTC](https://forum.kirupa.com/t/calling-constructor-in-condition-a-function-call-on-a-non-function-was-attempted/219001/1 "2007-03-13T02:04:15Z")

</div>

Hi guys,

Please help me somebody with this cos I have really no idea. I have made a simply condition calling a constructor of a class. Today I had to add an “else if”, what caused the compilator to show me “A function call on a non-function was attempted.”…

```auto

function loadIt() {
    if (var1 == "1") {
        var a:SomeClass = new SomeClass(true);
    } else if(var2 == "1"){
         var a:SomeClass = new SomeClass(false); //<- if this is not here, everything works fine
    } else {
        var b:SomeOtherClass = new SomeOtherClass();
        b.init();
    }
}

```

Any ideas? Thanks for any help!

Poco
