Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Scripting >> Examples >> Python-Perl-Powershell-Bash-Windows Batch >> Example 005 - Simple IF ELSEIF ELSE block


To perform IF / ELSE / ELSEIF branching.


Examples in Python, Perl, Powershell, Bash and Windows batch.
 

 

 

 

 

 

 

 

 

 

 

 

 

## NOTE
## For Windows Batch
## 1. The ELSE statement must be in the same line as the IF
## so if using () to enclose multiline statements,
## the ELSE must be immediately after the closing )
## 2. No native ELSEIF type of statement, simulated here with
## another inner IF block after the ELSE

 

Sample output - Python

 

Sample output - Perl

 

 

Sample output - Powershell

Sample output - Bash

Sample output - Windows batch

 

 

 

[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]