-1

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;
}
2
  • 4
    Take off the trailing comma $this->therm + $tstep * $bchange->dtherm(),. Commented Aug 25, 2015 at 12:12
  • Oh my god such a noob move.. I have been going over that for 30 minutes now. THANKYOU so much - better believe I will never make that mistake twice.. Commented Aug 25, 2015 at 12:16

1 Answer 1

1

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;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.