Skip to content
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

Syntax: define constant declaration #13

Closed
fly-lang opened this issue Feb 10, 2021 · 1 comment · Fixed by #28
Closed

Syntax: define constant declaration #13

fly-lang opened this issue Feb 10, 2021 · 1 comment · Fixed by #28
Labels
good first issue Good for newcomers planning For project plan tracking

Comments

@fly-lang
Copy link
Owner

fly-lang commented Feb 10, 2021

How to declare a constant in two different scopes:

  • at the package level
  • at the function level

Package Const

A constant can be accessed from all functions in that package. This constant needs to be declared out the functions and immediately initialized.

Function Const

A constant can be accessed from only elements in the same function where declared.

@fly-lang fly-lang added the good first issue Good for newcomers label Feb 10, 2021
@fly-lang fly-lang added the planning For project plan tracking label Feb 11, 2021
@marcoromagnolo
Copy link
Collaborator

Package Const (like Global Const but visible only in package namespace) are declared in the same way as Function Const but in different positions.

Examples:
const int a=1
const float b=1.0
const string c="text"
const bool d=false

@fly-lang fly-lang linked a pull request Aug 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers planning For project plan tracking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants