Often, procedures have different semantics depending on different values of their parameters. For such cases, we use this structure:
# [ if condition-1 ->
# intended-function-1
# else if condition-2 ->
# intended-function-2
# else if ...
# ...
# else ->
# intended-function-n ]
This means that if condition-1 is satisfied, the procedure has I/F intended-function-1, and so on; if none of the conditions are satisfied, the procedure has I/F intended-function-n.
Here's an example:
# [ if a < b ->
# return a
# else ->
# return a + b ]
if a < b:
return a
else:
return a + b
The notation I is used to mean ``identity,'' that is, do nothing, in compound I/Fs. For example:
# [ if a = 0 ->
# raise ValueError
# else ->
# I ]
This means: if a is zero, raise a ValueError exception,
else do nothing.