When I try to use an inline variable, then I get a Syntax error
. Here's my code:
procedure TfrmMain.btnSignInClick(Sender: TObject);
begin
var UserEmail := edtEmail.Text;
var UserPassword := edtPassword.Text;
var UserRememberMe := tglRememberMe.Checked;
SignIn(UserEmail, UserPassword);
end;
The Syntax error
happens on this line: var UserEmail := edtEmail.Text;
.
Changing the inline variable to also specify the type doesn't work either:
procedure TfrmMain.btnSignInClick(Sender: TObject);
begin
var UserEmail: String := edtEmail.Text;
var UserPassword: String := edtPassword.Text;
var UserRememberMe: Boolean := tglRememberMe.Checked;
SignIn(UserEmail, UserPassword);
end;
This is valid Delphi code that would work in VCL and FMX, but it doesn't seem to work in TMS Web Core. Why? What am I doing wrong?
According to a TMS Support Center post, the pas2js transpiler (which emits JavaScript code from Object Pascal code) does not support inline variables. So you'll have to use the old-school way of declaring variables: