Branching with if and else in Co-array Fortran is straightforward.
Note that in Co-array Fortran, you need to use then after the condition and end if to close the if block. Also, the logical operators are written as .and. and .or. instead of && and ||.
To run the program, save it in a file (e.g., if_else.f90) and compile it using a Co-array Fortran compiler:
In Co-array Fortran, there is no direct equivalent to the ternary operator. You’ll need to use a full if statement even for basic conditions.