user5262566
user5262566

Reputation: 21

Parse Error - JSCRIPT -> PHP

I feel like I am looking right at it however it has been some time and have not been able to solve this one - Although I know the answer is going to be a slap in the face. I am getting a parse error on ); and can't figure out why!

public function addchange($bchange, $tstep) {
        $nstate = $BodyModel->create5(
        $this->fat + $tstep * $bchange->df(),
        $this->lean + $tstep * $bchange->dl(),
        $this->glyc + $tstep * $bchange->dg(),
        $this->decw + $tstep * $bchange->dDecw(),
        $this->therm + $tstep * $bchange->dtherm(),
    ); // this is where im getting a parse error
    return $nstate;
}

JAVASCRIPT

    BodyModel.prototype.addchange = /*BodyModel*/ function(/*BodyChange*/ bchange, /*double*/ tstep)
{
    var nstate = BodyModel.create5(
        this.fat + tstep * bchange.df(),
        this.lean + tstep * bchange.dl(),
        this.glyc + tstep * bchange.dg(),
        this.decw + tstep * bchange.dDecw(),
        this.therm + tstep * bchange.dtherm()
    );
    return nstate;
}

Upvotes: 0

Views: 45

Answers (1)

Malay M
Malay M

Reputation: 1759

Remove the trailing comma in the passes argument.

public function addchange($bchange, $tstep) {
        $nstate = $BodyModel->create5(
        $this->fat + $tstep * $bchange->df(),
        $this->lean + $tstep * $bchange->dl(),
        $this->glyc + $tstep * $bchange->dg(),
        $this->decw + $tstep * $bchange->dDecw(),
        $this->therm + $tstep * $bchange->dtherm()
    );
    return $nstate;
}

Upvotes: 1

Related Questions