initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
---
|
||||
epic: 5
|
||||
story: 5.3
|
||||
title: "Previous Line Reference"
|
||||
status: draft
|
||||
---
|
||||
|
||||
## Epic 5 — Variables, Line References & Aggregators
|
||||
**Goal:** Transform the notepad into a lightweight computational document.
|
||||
|
||||
### Story 5.3: Previous Line Reference
|
||||
|
||||
As a **CalcPad user**,
|
||||
I want to use `prev` or `ans` to reference the result of the immediately preceding line,
|
||||
So that I can chain calculations naturally without tracking line numbers or variable names.
|
||||
|
||||
**Acceptance Criteria:**
|
||||
|
||||
**Given** line 1 evaluates to `50`
|
||||
**When** the user writes `prev * 2` on line 2
|
||||
**Then** the result on line 2 is `100`
|
||||
|
||||
**Given** line 1 evaluates to `50`
|
||||
**When** the user writes `ans + 10` on line 2
|
||||
**Then** the result on line 2 is `60`
|
||||
|
||||
**Given** `prev` is used on line 1 (the very first line)
|
||||
**When** the engine evaluates the sheet
|
||||
**Then** the engine reports an error such as "no previous line" (there is no preceding result)
|
||||
|
||||
**Given** line 3 is a comment or blank line, and line 4 uses `prev`
|
||||
**When** the engine evaluates the sheet
|
||||
**Then** `prev` resolves to the most recent line above that produced a numeric result (e.g., line 2)
|
||||
|
||||
**Given** line 2 uses `prev` referencing line 1, and the user inserts a new line between them
|
||||
**When** the engine re-evaluates
|
||||
**Then** `prev` on the original line now references the newly inserted line (it always means "the line directly above")
|
||||
|
||||
**Given** line 1 evaluates to `$50` (with currency)
|
||||
**When** line 2 uses `prev + $25`
|
||||
**Then** the result is `$75` with the currency context preserved
|
||||
Reference in New Issue
Block a user