fork(1) download
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. int foo() { return 0; }
  5. int bar() { return 2; }
  6.  
  7. int main() {
  8. if (int b = foo()) {
  9. std::cout << "b = " << b;
  10. }
  11. else if (int b = bar() && false) {
  12. std::cout << "b = " << b;
  13. }
  14. else {
  15. std::cout << "b = " << b + 2;
  16. }
  17. }
  18.  
Success #stdin #stdout 0s 4376KB
stdin
Standard input is empty
stdout
b = 2