const() function not work in certain situation #12207
IlysvlVEizbr
started this conversation in
General
Replies: 2 comments 4 replies
-
Try the most recent nightly build, and you do not have to import const. |
Beta Was this translation helpful? Give feedback.
1 reply
-
This is not a MicroPython bug. CONST_X = const(123)
CONST_Y = const(CONST_X + 1)
print(CONST_Y)
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When using the const function in the REPL environment according to the examples in the official documentation, I encountered the following error:
Other known scenarios that can trigger the same error include:
But the parameters of these const() are indeed constants (after calculated). At the same time, in the following examples, const() will not throw an error.
Hardware I am using: Pyb v11
Firmware I am using: MicroPython v1.20.0 on 2023-04-26
Beta Was this translation helpful? Give feedback.
All reactions