Here, we will demonstrate the logical NOT (!) operator and print the appropriate message on the console screen.
Logical NOT (!) operation:
The logical NOT operation reverse the condition result. If the result of the condition is true then it becomes false or vice versa.
Program/Source Code:
The source code to demonstrate the logical NOT (!) 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 two variables num1, num2 that are initialized with 10, 10 respectively. Then we compared variables and performed a logical NOT (!) operation 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