The Twig has ternary operators for logic. Using a question mark (?), we can perform a basic is true or not empty operation, whereas a question mark and colon (?:) perform a basic is false or is empty operation.
You may also use the if and else logic to provide different outputs based on variables.