Flow control: for clause
Tasks: 1.1. for statement example 2.2. oneliner 3.3. other alternatives
Bash | Perl | Python |
---|---|---|
|
|
|
Tasks: 1.1. for statement example 2.2. oneliner 3.3. other alternatives
Bash | Perl | Python |
---|---|---|
|
|
|
Tasks: 1.1. read user input in while statement example 2.2. read user input in while statement with assignmnet in conditional
Bash | Perl | Python |
---|---|---|
|
|
|
if empty???
Tasks: 1.1. if statement example 2.2. other alternatives for 'if statement'
Bash | Perl | Python |
---|---|---|
|
|
|
In perl, next and last are used instead of continue and break. In python, you can use 'else' with 'for loop', which mean there is not break happens during the 'for loop' execution
Tasks:
Bash | Perl | Python |
---|---|---|
|
|
|
In bash: '==' is for comparing strings, while 'eq' is for comparing numbers with the exception that if you use '(())', then '==' is for comparing numbers. In perl: '==' is for comparing numbers; while 'eq' is for comparing strings. In python: '==' is for all objects comparison, however remeber to use '==' when comparing values and 'is' when comparing identities.
Tasks: 1.1. define a function named compare_num() 2.2. call the function with two number as parameters
Bash | Perl | Python |
---|---|---|
|
|
|
Tasks: 1.1. define a function named compare_str() 2.2. call the function with two strings as parameters 3.3. notes
Bash | Perl | Python |
---|---|---|
|
|
|
Tasks: 1.1. logic operator for "or" 2.2. alternative expression
Bash | Perl | Python |
---|---|---|
|
|
|