qsharp icon indicating copy to clipboard operation
qsharp copied to clipboard

Make code examples in /samples/language folder more user-friendly

Open tcNickolas opened this issue 1 year ago • 2 comments
trafficstars

Is your feature request related to a problem? Please describe. Currently the code samples in the /samples/language folder don't produce any output; they evaluate some expressions, but the results are only listed in the comments, not printed for the user to see. This makes any mistakes (such as https://github.com/microsoft/qsharp/pull/1467) hard to spot, and the experience of using them not intuitive.

Describe the solution you'd like We can add some Message commands to print the results of expression evaluation instead of assigning them to variables in most cases (unless, of course, assigning a value to a variable is the point of the example). This will let user compare the results with what they should be easily.

tcNickolas avatar May 03 '24 17:05 tcNickolas

Taking Array.qs for example:

  • It mentions syntax elements that are not illustrated in the sample, [0, size = 10] syntax and Length function, we should add them as well.
  • We should print the results of variable assignments: after let intArray : Int[] = [1, 2, 3, 4] we should add Message($"{intArray}");, after each let slice = ... - Message($"{slice}");, and so on.

tcNickolas avatar May 09 '24 16:05 tcNickolas

Working on this

goshua13 avatar May 10 '24 03:05 goshua13