vendredi 19 avril 2019

Why is it not possible to have multiple arguments for single condition in if-statement?

Why do no languages allow for multiple arguments for a single if-statement condition? Why can I do if (x == true) {...}, but I can't do if (x,y,z == true) {...}? I understand that some posts say you can get around this problem with a switch statement, but I want to know why it's not possible to use an if-statement. I want to know the theory behind it. Is it just because nobody has added it to there language's syntax? Is it prevented by the compiler or something similar?

Aucun commentaire:

Enregistrer un commentaire