Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
Write a Ternary Operator to check if a number is even or odd.
Use the modulus operator to check for remainder.
Create a Ternary statement that assigns a grade based on score (pass/fail).
Check if score is greater than or equal to 50.
What does the Ternary Operator syntax condition ? x : y do?
Think about how an if-else structure operates.
True or False: The Ternary Operator can be used for complex conditionals.
Consider when it's best to use simple versus complex conditionals.
Write a Ternary Operator to determine a student's status based on their grades. If their average is above 75, they get a scholarship; otherwise, they don't.
Ensure you're comparing the average correctly.
Create a nested Ternary Operator to evaluate a score from a test: if the score is greater than or equal to 90, return 'A'; if it's greater than or equal to 80, return 'B'; otherwise, return 'C'.
Chain conditions together for proper comparison.
5 more questions in this section. Enroll free to practise them all.
Enroll free