hi All,
i just started to work with enumerated variables.
for the code below and attached i am trying to increment the value of the s variable and set the t variable one step backwards of s.
please help with how i could do this.
thank you
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
TStatus = (action_1, action_2, action_3, action_4, action_5);
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.Button1Click(Sender: TObject);
var
s: TStatus;
t: TStatus; //one action before action s
r: string;
begin
s:= action_4; //how can i increment s to action 5? how can i set t to action 4?
writestr(r, s);
Memo1.Append(r);
Memo1.Append(inttostr(ord(s)));
end;
end.