I want to write an if-else statement as a logical statement. I know that:
if (statement1){
b=c
}
else{
b=d
}
can be written as:
b=(statement1 && c)||(!statement1 && d)
But how do I write the following if-else statements as logical?:
if (statement1){
b=c
}
else if (statement2){
b=d
}
else{
b=e
}
I'm sorry if there is already a post about this. I have tried, but couldn't find anything similar to my problem.
Aucun commentaire:
Enregistrer un commentaire