Damage formula question for an attack requiring a state

Hi! I'm brand new to Rpgmaker so I'm definitely a noob. I'm working on a skill that requires an actor to have a certain state. If the actor has the state, the skill would remove the state, and use a certain damage formula - but if the actor is not affected by the state, it uses a separate damage formula. Here's what I have so far:

if (a.isStateAffected(55)) a.removeState(55); a.atk * 2 - b.def; else; a.atk * 1.5 - b.def

The issue is that it does 0 damage, regardless of the state's presence. I apologize for my noobliness haha, any help is appreciated. Thanks!
Hi! I'm brand new to Rpgmaker so I'm definitely a noob. I'm working on a skill that requires an actor to have a certain state. If the actor has the state, the skill would remove the state, and use a certain damage formula - but if the actor is not affected by the state, it uses a separate damage formula. Here's what I have so far:

if (a.isStateAffected(55)) a.removeState(55); a.atk * 2 - b.def; else; a.atk * 1.5 - b.def

The issue is that it does 0 damage, regardless of the state's presence. I apologize for my noobliness haha, any help is appreciated. Thanks!
JavaScript:
let damage; if (a.isStateAffected(55)) { a.removeState(55); damage = a.atk * 2 - b.def } else { damage = a.atk * 1.5 - b.def }; damage

You have a few issues here: first of all is that since you only did your if statement as a single line if (without curly braces) only that "a.removeState(55)" is considered a part of it, which means your else doesn't actually connect to an if. That causes an error, which is why your formula deals 0 damage. But besides that, a valid formula will only return the last value it evaluated, which in this case would be a.atk * 1.5 - b.def. So if you fixed the problem with the if, that would be the only formula this skill ever uses. I've fixed that for you so that it uses a damage variable which gets set accordingly and then returned at the end.
In addition to what Trihan pointed out, you also have an erroneous semicolon after else which will certainly cause an error or at least unexpected behavior in the code even if the commands after the if were correctly contained in a code block.

(this error is corrected in Trihan's example for you, I just wanted to point it out so you're aware)

Original thread: https://forums.rpgmakerweb.com/threads/damage-formula-question-for-an-attack-requiring-a-state.155963/