-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for inline-declared variables #973
Comments
ghaith
changed the title
Add support for inlined variables
Add support for inline-declared variables
Sep 25, 2023
ghaith
pushed a commit
that referenced
this issue
Oct 18, 2023
Variables can be defined in the body using the syntax ```st {def} VAR y : DINT := 0; (*Pragma to avoid confusion with var blocks *) (*Pragma is optional once in body*) VAR x := 0; (*Implicit type declaration to DINT*) FOR VAR x := 0 TO 10 BEGIN (*Implicit variable declaration as loop counter*) END_FOR ``` Ref: #973
ghaith
pushed a commit
that referenced
this issue
Oct 24, 2023
Variables can be defined in the body using the syntax ```st {def} VAR y : DINT := 0; (*Pragma to avoid confusion with var blocks *) (*Pragma is optional once in body*) VAR x := 0; (*Implicit type declaration to DINT*) FOR VAR x := 0 TO 10 BEGIN (*Implicit variable declaration as loop counter*) END_FOR ``` Ref: #973
ghaith
pushed a commit
that referenced
this issue
Nov 10, 2023
Variables can be defined in the body using the syntax ```st {def} VAR y : DINT := 0; (*Pragma to avoid confusion with var blocks *) (*Pragma is optional once in body*) VAR x := 0; (*Implicit type declaration to DINT*) FOR VAR x := 0 TO 10 BEGIN (*Implicit variable declaration as loop counter*) END_FOR ``` Ref: #973
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
As part of #947 it makes sense to support on the fly declaration of temporary variables for all languages
Describe the solution you'd like
In ST these variables would then have to be marked with a Pragma, and in general will behave as temp variable. They come into scope on the line they are declared in. And out of scope if their parent scope is also going out of scope (Control statements).
A declaration can look like this:
The text was updated successfully, but these errors were encountered: