Namespace declarations can only occur on a global scope.

G Pavithra 1 Reputation point
2022-12-16T05:52:03.353+00:00

271220-screenshot-from-2022-12-16-11-17-29.png

How to avoid the error :

Error QS4001: Namespace declarations can only occur on a global scope.

I have written the following code in a .qs file.

namespace Test {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Measurement;
open Microsoft.Quantum.Canon;
operation GenerateRandomBits(n : Int) : Result[] {
use qubits = Qubit[n];
ApplyToEach(H, qubits);
return MultiM(qubits);
}
}

Also, how to create a folder in azure quantum workspace jupyter notebook?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

2 answers

Sort by: Most helpful
  1. brtrach-MSFT 17,731 Reputation points Microsoft Employee Moderator
    2022-12-23T05:08:44.313+00:00

    @G Pavithra We would like to assist you further on this matter as we believe we need to put you in touch with support in order to resolve this error. We will follow up with a private message.

    1 person found this answer helpful.

  2. Sakibul Islam Rayhan 0 Reputation points
    2023-01-26T17:58:46.3733333+00:00

    I am also having same kind of problem what to do?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.