Here, we will compare variables using the logical OR (||) operator and print the appropriate message on the console screen.
Logical OR (||) operation:
In the case of logical OR operation, if any one condition is true then the result will be true otherwise result is considered false.
Program/Source Code:
The source code to demonstrate the logical OR (||) operator is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we imported a package Swift to use the print() function using the below statement,
Here, we created three variables num1, num2, num3 that are initialized with 10, 50, 10 respectively. Then we compared variables and performed a logical OR (||) operation to compare numbers and printed the appropriate message on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer