Jump to content

History variables: Difference between revisions

m
→‎{{header|Ada}}: Fixed typo (ect. → etc.)
m (→‎{{header|Ada}}: Fixed typo (ect. → etc.))
Line 53:
-- non-destructively search for old values
function Peek(V: Variable; Generation: Natural := 1) return Item_Type;
-- V.Peek(0) returns current value; V.Peek(1) the previous value, ectetc.
-- when calling V.Peek(i), i must be in 0 .. V.Defined-1, else Constraint_Error is raised
 
-- destructively restore previous value
procedure Undo(V: in out Variable);
-- old V.Peek(0) is forgotten, old V.Peek(i) is new V.Peek(i-1), ectetc.
-- accordingly, V.Defined decrements by 1
-- special case: if V.Defined=0 then V.Undo does not change V
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.