Python – Compare Two Strings

Check If Two Strings Are Equal using Python Use == operator to test if two given strings are equal or not. You can use != as not equal to operator. It returns false if string matches. Example In this example, we initialize two variable with sting and compare if both stings are equal or not.

Output: Equal Another Example Here is another sample Python program which will prompt user to enter a strings. Then compare the input string with another predefined string.

Read More

C – if-else

C – If-Else Statement The if-else statements are used to run specific code based on condition. The if statement executes a statement if a specified condition is true. If the condition is false, another statement can be executed. Basically, there are 4 types of if statements. if statement if-else statement if-else-if ladder statement nested if statement 1. if Statement An if statement evaluates the expression written inside the parenthesis. if (Expression) { // statement block } If the expression returns true, The if statement block will be executed. If the…

Read More

Bash – If-else

Bash if else Statment If-else is the decision making statements in bash scripting similar to any other programming. Where execution of a block of statement is decided based on the result of if condition. If it evaluates a condition to true, then if block code is executed, on the false condition, the else block code is executed, which is optional. Syntax:

basically, there are 4 types of if statements. if statement if-else statement else-if ladder statement nested if statement 1. Bash – if Statement Example This is the basic…

Read More