mercredi 19 juillet 2017

Two consecutive but separate if cases

I have 2 consecutive if cases like this:

if(this == test) {
  set a variable
} else if () {
  set a variable to something else
} else {
  error
}

if (variable set earlier is this) {
  do something
} else {
  do the other thing
}

do some more stuff

this feels wrong, to have to separate if cases. It looks messy or whatever. I'm not that good at programming, so is this an efficient and clean way to write what I want it to do?

Aucun commentaire:

Enregistrer un commentaire