1
$\begingroup$

enter image description here

I am having challenges with Microsoft Q#. I wrote this short code and it says it can only occur at a global scope.

How do I fix this error? Any ideas? Thank you

$\endgroup$
1
  • 1
    $\begingroup$ thanks is working $\endgroup$ Jul 3, 2020 at 21:31

1 Answer 1

1
$\begingroup$

This error is about the “global scope” of the namespace declaration, which is unrelated to the “global phase” mentioned in your Q# code.

In Q# Jupyter notebooks, code is automatically wrapped in a namespace - there is no need to declare one in your code. If you remove the namespace Quantum.Kata.SingleQubitGates declaration from your code, it should work.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.