titus.genpy.ifNotNullElse

titus.genpy.ifNotNullElse(state, scope, nameExpr, nameType, thenClause, elseClause)[source]

Helper function for ifnotnull as an expression.

Parameters:
  • state (titus.genpy.ExecutionState) – exeuction state
  • scope (titus.util.DynamicScope) – dynamic scope object
  • nameExpr (dict) – maps from new variable names to expressions
  • nameType (string) – expected type as a JSON-encoded string
  • thenClause (callable) – function that is called if all expressions are not None
  • elseClause (callable) – function that is called if any expressions are None
Return type:

result of thenClause or elseClause

Returns:

if all expressions are not None, returns the result of thenClause, otherwise returns the result of elseClause