From 47f85184360cfa23c98f9bfa41f1f7df3323a5a5 Mon Sep 17 00:00:00 2001 From: Clarence Bakosi Date: Wed, 29 Oct 2025 19:31:11 +0100 Subject: [PATCH] feat(curriculum): Add interactive examples to What Are Comparison Operators, and How Do They Work (#63246) --- .../673271dffbc34fda31da9515.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/blocks/lecture-working-with-comparison-and-boolean-operators/673271dffbc34fda31da9515.md b/curriculum/challenges/english/blocks/lecture-working-with-comparison-and-boolean-operators/673271dffbc34fda31da9515.md index 6d8446e0a93..0278c821db6 100644 --- a/curriculum/challenges/english/blocks/lecture-working-with-comparison-and-boolean-operators/673271dffbc34fda31da9515.md +++ b/curriculum/challenges/english/blocks/lecture-working-with-comparison-and-boolean-operators/673271dffbc34fda31da9515.md @@ -5,12 +5,14 @@ challengeType: 19 dashedName: what-are-comparison-operators-and-how-do-they-work --- -# --description-- +# --interactive-- Comparison operators allow you to compare two values and return a `true` or `false` result. You can then use the result to make a decision or control the flow of your program. You use comparisons in `if` statements, loops, and many other situations where you need to make decisions based on certain conditions. Let's dive into the most common comparison operators and see how they work. The greater than operator, represented by a right-angle bracket (`>`), checks if the value on the left is greater than the one on the right: +:::interactive_editor + ```js let a = 6; let b = 9; @@ -19,8 +21,12 @@ console.log(a > b); // false console.log(b > a); // true ``` +::: + The greater than or equal operator, represented by a right-angle bracket and the equals sign (`>=`), checks if the value on the left is either greater than or equal to the one on the right: +:::interactive_editor + ```js let a = 6; let b = 9; @@ -31,8 +37,12 @@ console.log(b >= a); // true console.log(a >= c); // true ``` +::: + The lesser than operator, represented by a left-angle bracket (`<`) works similarly to `>`, but in reverse. It checks if the value on the left is smaller than the one on the right: +:::interactive_editor + ```js let a = 6; let b = 9; @@ -41,8 +51,12 @@ console.log(a < b); // true console.log(b < a); // false ``` +::: + The less than or equal operator, represented by a left-angle bracket and the equals sign (`<=`) checks if the value on the left is smaller than or equal to the one on the right: +:::interactive_editor + ```js let a = 6; let b = 9; @@ -53,6 +67,8 @@ console.log(b <= a); // false console.log(a <= c); // true ``` +::: + # --questions-- ## --text--