Comments
Comments start with // and can be in the middle or end of a line.
// This is a comment
int a = 2 // This is a comment after a statement
Doc comments can be written with ///:
import "std/math" as math
/// The value of pi
rat pi = 3.141592653589793
/// A function to find the square root of an array of integers
/// @param The array of integers to square root
/// @returns An array of square roots
fn sqrtAll(int[] nums) -> rat[] {
mut rat[] rootVals = []
for i in nums {
rootVals[i] = math.sqrt(nums[i])
}
return rootVals
}
These behave the same as normal comments since it's only the // that matters, all the other /s are optional. However, the LSP will only recognise /// as doc comments.