microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
samples/language/MultiFileProject/src/Main.qs
18lines · modecode
| 1 | // # Sample |
| 2 | // Multi File Project |
| 3 | // |
| 4 | // # Description |
| 5 | // Organizing code into multiple Q# source files is an important part of |
| 6 | // writing readable and maintainable code. In this project, we have `Main.qs`, |
| 7 | // and `Particle.qs`, which defines a new namespace for particle operations. |
| 8 | // The presence of a Q# manifest file (`qsharp.json`) tells the compiler |
| 9 | // to include all Q# files under `src/`. |
| 10 | |
| 11 | import Particle.*; |
| 12 | function Main() : Unit { |
| 13 | let particleA = new Particle { X = 0, Y = 0, Z = 0 }; |
| 14 | let particleB = new Particle { X = 1, Y = 1, Z = 1 }; |
| 15 | |
| 16 | let particleC = addParticles(particleA, particleB); |
| 17 | Message($"Particle C: Particle({particleC.X}, {particleC.Y}, {particleC.Z})") |
| 18 | } |
| 19 | |