fix: setting type of array length to const int in OQ3 example #644
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
In https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/braket_features/Getting_Started_with_OpenQASM_on_Braket.ipynb -- first of "Advanced OpenQASM features", the
is invalid OpenQASM.
n
should be aconst
Ref: https://openqasm.com/language/types.html#arrays citation for this (look for the Note: "Note that bit, bit[n] and stretch are not valid array base types, nor are any quantum types.")
Description of changes:
Following the example here: https://openqasm.com/language/types.html#qubits, I made the change
int[32] n = 5;
->const int[32] n = 5;
in code cell 39 of https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/braket_features/Getting_Started_with_OpenQASM_on_Braket.ipynbI also verified that the cell, and the next run correctly.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.