diff --git a/samples/algorithms/DotProductViaPhaseEstimation.qs b/samples/algorithms/DotProductViaPhaseEstimation.qs index 91aecf437f..63e9e04e7a 100644 --- a/samples/algorithms/DotProductViaPhaseEstimation.qs +++ b/samples/algorithms/DotProductViaPhaseEstimation.qs @@ -67,7 +67,7 @@ namespace IterativePhaseEstimation { return x; } - operation ClassicalInnerProduct(theta1 : Double, theta2 : Double) : Double { + function ClassicalInnerProduct(theta1 : Double, theta2 : Double) : Double { return Cos(theta1 / 2.0) * Cos(theta2 / 2.0) + Sin(theta1 / 2.0) * Sin(theta2 / 2.0); } diff --git a/samples/language/ArithmeticOperators.qs b/samples/language/ArithmeticOperators.qs index 999255de42..a14aae0dd7 100644 --- a/samples/language/ArithmeticOperators.qs +++ b/samples/language/ArithmeticOperators.qs @@ -8,7 +8,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { // `-`, when applied to a single value on its right, negates the value. diff --git a/samples/language/Array.qs b/samples/language/Array.qs index 30f0d1d096..8b6ff34caa 100644 --- a/samples/language/Array.qs +++ b/samples/language/Array.qs @@ -19,7 +19,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Int[] { + function Main() : Int[] { // A basic Int Array literal let intArray : Int[] = [1, 2, 3, 4]; @@ -27,21 +27,21 @@ namespace MyQuantumApp { // A basic String Array literal let stringArray = ["a", "string", "array"]; - Message($"{stringArray}"); + Message($"String Array: {stringArray}"); // A new array expression creating the array `[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]` let repeatedArray = [0, size = 10]; - Message($"{repeatedArray}"); + Message($"Repeated Array: {repeatedArray}"); let repeatedArray = Repeated(0, 10); // contains [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - Message($"{repeatedArray}"); + Message($"Repeated Array: {repeatedArray}"); // Arrays can be sliced with ranges. let slice = intArray[1..2..4]; // contains [2,4] - Message($"{slice}"); + Message($"Sliced array: {slice}"); let slice = intArray[2..-1..0]; // contains [3,2,1] - Message($"{slice}"); + Message($"Sliced array: {slice}"); let slice = intArray[...]; // contains [1, 2, 3, 4]; - Message($"{slice}"); + Message($"Sliced array: {slice}"); return intArray; } diff --git a/samples/language/BigInt.qs b/samples/language/BigInt.qs index ec75395184..bdcc0bd30e 100644 --- a/samples/language/BigInt.qs +++ b/samples/language/BigInt.qs @@ -8,7 +8,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : BigInt { + function Main() : BigInt { // Numbers can be declared in hex, octal, decimal, or binary. let foo = 0x42L; Message($"Hexadecimal BigInt: {foo}"); diff --git a/samples/language/BitwiseOperators.qs b/samples/language/BitwiseOperators.qs index 289eb6f316..d3526bedd5 100644 --- a/samples/language/BitwiseOperators.qs +++ b/samples/language/BitwiseOperators.qs @@ -8,7 +8,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { // `~~~` performs a bitwise NOT on the bits of an integer. diff --git a/samples/language/Bool.qs b/samples/language/Bool.qs index 7c9d8f59b4..c3505edae7 100644 --- a/samples/language/Bool.qs +++ b/samples/language/Bool.qs @@ -7,7 +7,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Bool { + function Main() : Bool { // `Bool`s can be operated upon with boolean operators: let andOp = true and true; Message($"AND operation: {andOp}"); diff --git a/samples/language/Comments.qs b/samples/language/Comments.qs index e8fe1d47d1..ddd129290e 100644 --- a/samples/language/Comments.qs +++ b/samples/language/Comments.qs @@ -12,9 +12,9 @@ namespace MyQuantumApp { /// This is a doc-comment for the `Main` operation. @EntryPoint() - operation Main() : Result[] { + function Main() : Result[] { // Comments can go anywhere in a program, although they typically // preface what they refer to. return []; } -} \ No newline at end of file +} diff --git a/samples/language/ComparisonOperators.qs b/samples/language/ComparisonOperators.qs index c068ba1064..404db75eeb 100644 --- a/samples/language/ComparisonOperators.qs +++ b/samples/language/ComparisonOperators.qs @@ -8,7 +8,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { // `==` tests if the first value is equivalent to the second value. diff --git a/samples/language/ConditionalBranching.qs b/samples/language/ConditionalBranching.qs index c3a1263d80..d68f917a07 100644 --- a/samples/language/ConditionalBranching.qs +++ b/samples/language/ConditionalBranching.qs @@ -9,7 +9,7 @@ /// If expressions allow your code to branch, or conditionally execute parts of a Q# program. namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { let number = 5; // Conditionally messages "Fizz" if the `number`, in this case 5, is divisible by 3. // Since 5 is not divisible by 3, the message "Fizz" will not be printed. diff --git a/samples/language/CopyAndUpdateOperator.qs b/samples/language/CopyAndUpdateOperator.qs index f12dc9d3b3..bdc05f34d2 100644 --- a/samples/language/CopyAndUpdateOperator.qs +++ b/samples/language/CopyAndUpdateOperator.qs @@ -10,7 +10,7 @@ namespace MyQuantumApp { newtype Pair = (first : Int, second : Int); @EntryPoint() - operation Main() : Unit { + function Main() : Unit { let array = [10, 11, 12, 13]; let pair = Pair(20, 21); diff --git a/samples/language/Double.qs b/samples/language/Double.qs index 72f2af489f..d6ae2be508 100644 --- a/samples/language/Double.qs +++ b/samples/language/Double.qs @@ -10,7 +10,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Double { + function Main() : Double { // A double declared in standard notation. let double = 0.1973269804; @@ -19,4 +19,4 @@ namespace MyQuantumApp { return double; } -} \ No newline at end of file +} diff --git a/samples/language/EntryPoint.qs b/samples/language/EntryPoint.qs index 4be7b7900f..7fce03cef7 100644 --- a/samples/language/EntryPoint.qs +++ b/samples/language/EntryPoint.qs @@ -9,7 +9,7 @@ namespace MyQuantumApp { // The Q# compiler identifies `Main` as the entry point operation because it is marked with the `@EntryPoint()` attribute. @EntryPoint() - operation Main() : Result[] { + function Main() : Result[] { return []; } -} \ No newline at end of file +} diff --git a/samples/language/ForLoops.qs b/samples/language/ForLoops.qs index 4c40d886d6..23603053e9 100644 --- a/samples/language/ForLoops.qs +++ b/samples/language/ForLoops.qs @@ -8,7 +8,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { // For loop over `Range` for i in 0..5 {} diff --git a/samples/language/Int.qs b/samples/language/Int.qs index b8c4b61423..a787e37c91 100644 --- a/samples/language/Int.qs +++ b/samples/language/Int.qs @@ -7,7 +7,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Int { + function Main() : Int { // Numbers can be declared in hex, octal, decimal, or binary. let foo = 0x42; Message($"Hexadecimal: {foo}"); @@ -34,4 +34,4 @@ namespace MyQuantumApp { return foo; } -} \ No newline at end of file +} diff --git a/samples/language/LambdaExpression.qs b/samples/language/LambdaExpression.qs index 822475b36d..382026cd1b 100644 --- a/samples/language/LambdaExpression.qs +++ b/samples/language/LambdaExpression.qs @@ -34,4 +34,4 @@ namespace MyQuantumApp { let incremented = Mapped(x -> x + 1, intArray); Message($"Array after incrementing each element using Map: {incremented}"); } -} \ No newline at end of file +} diff --git a/samples/language/LogicalOperators.qs b/samples/language/LogicalOperators.qs index 17877d15bf..bdd22a6ff3 100644 --- a/samples/language/LogicalOperators.qs +++ b/samples/language/LogicalOperators.qs @@ -8,7 +8,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { // `and` performs the Boolean And on two Boolean values. diff --git a/samples/language/MultiFileProject/src/Main.qs b/samples/language/MultiFileProject/src/Main.qs index c6030735d3..3008f6e0f5 100644 --- a/samples/language/MultiFileProject/src/Main.qs +++ b/samples/language/MultiFileProject/src/Main.qs @@ -15,5 +15,6 @@ namespace MyQuantumApp { let particleB = Particle(1, 1, 1); let particleC = addParticles(particleA, particleB); + Message($"Particle C: Particle({particleC::x}, {particleC::y}, {particleC::z})") } } diff --git a/samples/language/PartialApplication.qs b/samples/language/PartialApplication.qs index 9413fb1930..d4e3d74239 100644 --- a/samples/language/PartialApplication.qs +++ b/samples/language/PartialApplication.qs @@ -8,7 +8,7 @@ namespace MyQuantumApp { open Microsoft.Quantum.Arrays; @EntryPoint() - operation Main() : Unit { + function Main() : Unit { // This takes our adding function and partially applies it, // filling the second argument with `1` and returning another // function that takes one argument and passes it in to `Add`. diff --git a/samples/language/Range.qs b/samples/language/Range.qs index e5fad74d31..4699d1ae67 100644 --- a/samples/language/Range.qs +++ b/samples/language/Range.qs @@ -11,7 +11,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Range { + function Main() : Range { // Ranges can be captured as local variables. diff --git a/samples/language/ReturnStatement.qs b/samples/language/ReturnStatement.qs index 1ae6d924c3..0a298001fb 100644 --- a/samples/language/ReturnStatement.qs +++ b/samples/language/ReturnStatement.qs @@ -6,7 +6,7 @@ /// return control flow to the callee's scope with a given value. namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { // After the execution of the function `Returns42`, control flow // will return to this scope. let number42 = Returns42(); @@ -26,4 +26,4 @@ namespace MyQuantumApp { // If a callable is annotated to return any other type besides `Unit`, then it // must return a value of that type. } -} \ No newline at end of file +} diff --git a/samples/language/String.qs b/samples/language/String.qs index da158db233..7fc767abcf 100644 --- a/samples/language/String.qs +++ b/samples/language/String.qs @@ -6,7 +6,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : String { + function Main() : String { // Strings literals are declared with double quotes: let myString = "Foo"; @@ -20,4 +20,4 @@ namespace MyQuantumApp { return myString; } -} \ No newline at end of file +} diff --git a/samples/language/Ternary.qs b/samples/language/Ternary.qs index 32c7848488..b8664d5b1d 100644 --- a/samples/language/Ternary.qs +++ b/samples/language/Ternary.qs @@ -9,7 +9,7 @@ /// `[condition] ? [true branch] | [else branch]` namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { let fahrenheit = -40; // The below ternary expression sets the value of `fahrenheit` to its absolute value. diff --git a/samples/language/Tuple.qs b/samples/language/Tuple.qs index 6b4aad7ad7..a99b9679c5 100644 --- a/samples/language/Tuple.qs +++ b/samples/language/Tuple.qs @@ -11,7 +11,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : (Int, String) { + function Main() : (Int, String) { // A tuple of type `String`, `Int`, and `Double` let myTuple = ("Id", 0, 1.); Message($"Tuple: {myTuple}"); diff --git a/samples/language/TypeDeclarations.qs b/samples/language/TypeDeclarations.qs index dbcbefc15f..f7e717a718 100644 --- a/samples/language/TypeDeclarations.qs +++ b/samples/language/TypeDeclarations.qs @@ -6,7 +6,7 @@ /// in Q#. They are immutable but support a copy-and-update construct. namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { // UDTs are defined with the `newtype` keyword. newtype Point3d = (X : Double, Y : Double, Z : Double); diff --git a/samples/language/Unit.qs b/samples/language/Unit.qs index 80b2b22a8b..63aa62363d 100644 --- a/samples/language/Unit.qs +++ b/samples/language/Unit.qs @@ -8,11 +8,10 @@ namespace MyQuantumApp { @EntryPoint() - operation ExplicitReturn() : Unit { - // Explicitly return `Unit`. + function ExplicitReturn() : Unit { return (); } operation NoReturn() : Unit { // No return, thus implicitly returning `Unit`. } -} \ No newline at end of file +} diff --git a/samples/language/Variables.qs b/samples/language/Variables.qs index 640cd83097..ab03581342 100644 --- a/samples/language/Variables.qs +++ b/samples/language/Variables.qs @@ -5,7 +5,7 @@ /// Variables in Q# are immutable by default and can be shadowed. namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { // Immutable variables are declared with the `let` keyword: let immutableInt = 42; Message($"Immutable Int: {immutableInt}"); diff --git a/samples/language/WhileLoops.qs b/samples/language/WhileLoops.qs index bf3f3086c5..f64cc16be1 100644 --- a/samples/language/WhileLoops.qs +++ b/samples/language/WhileLoops.qs @@ -9,7 +9,7 @@ namespace MyQuantumApp { @EntryPoint() - operation Main() : Unit { + function Main() : Unit { mutable x = 0; while x < 3 { set x += 1;