New Features of 11, 14, 17
Version 11
Version 14
Version 17
Selection statement with Initializer
The if conditional statement can contain an initial additional statement to restrict scope.
Ex:
#include <iostream>
using namespace std ;
int main( int noArguments , char* args[] )
{
int x1 = 5 ;
if ( x1=6; x1 == 6 )
cout << "Inside the if." << endl ;
}
Output:
a4m13w7@L-3NN30Z2 ~/clang/versions/17
$ g++ -std=c++17 if1.cpp
a4m13w7@L-3NN30Z2 ~/clang/versions/17
$ ./a.exe
Inside the if.