mercredi 18 novembre 2020

when need to do this in c++; if(x = 0) {} [duplicate]

I noticed sometimes developers do these in their project;

while(int x = 0) {//run code}
int y = 0;
if (y = someFunction())
{//run code}

I want ask;

  1. why c++ allow to do these in loops like while,(maybe for as well?) and if-else statements, what is the usage?
  2. when someone should do this in his project?
  3. and when conditions like these give result true?

Aucun commentaire:

Enregistrer un commentaire