Skip to content

Conversation

@pearmini
Copy link
Collaborator

@pearmini pearmini commented Nov 14, 2025

/**
 * ============================================================================
 * =                            X to 5                                        =
 * ============================================================================
 *
 * This example demonstrates how to use `echo.key()` to track values across
 * multiple iterations. When you use the same key for different values across
 * iterations, they are displayed in a table format where each key becomes a row.
 *
 * This makes it easy to visualize how variables change over time in loops or
 * iterative algorithms.
 */

//➜ +-------+---+---+----+
//➜ |   {x} | 0 | 1 |  2 |
//➜ |-------|---|---|----|
//➜ | {x^2} | 0 | 1 |  4 |
//➜ |-------|---|---|----|
//➜ | {x^3} | 0 | 1 |  8 |
//➜ |-------|---|---|----|
//➜ | {x^4} | 0 | 1 | 16 |
//➜ |-------|---|---|----|
//➜ | {x^5} | 0 | 1 | 32 |
//➜ +-------+---+---+----+
{
  let x = 0;
  while (x < 3) {
    echo.key("x")(x);
    echo.key("x^2")(x ** 2);
    echo.key("x^3")(x ** 3);
    echo.key("x^4")(x ** 4);
    echo.key("x^5")(x ** 5);
    x++;
  }
}

@vercel
Copy link

vercel bot commented Nov 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
recho-notebook Ready Ready Preview Comment Nov 14, 2025 4:59am

@pearmini pearmini changed the title Add example x to 5 [Example] X to 5 Nov 14, 2025
@pearmini pearmini added the Example Add a new example label Nov 14, 2025
@pearmini pearmini merged commit 1cef70a into main Nov 14, 2025
2 of 3 checks passed
@pearmini pearmini deleted the example-x-to-5 branch November 14, 2025 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Example Add a new example

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants