From 6fac027dd6ad41485ec92a259f60c913f4911d1c Mon Sep 17 00:00:00 2001 From: Robin Stringer Date: Mon, 9 Jan 2023 14:42:27 +0000 Subject: [PATCH] Updates PR with code formatting Backticks for inline and single line code blocks / examples. --- src/basic-syntax/compound-types.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/basic-syntax/compound-types.md b/src/basic-syntax/compound-types.md index 7ad8e25c..bc61ce71 100644 --- a/src/basic-syntax/compound-types.md +++ b/src/basic-syntax/compound-types.md @@ -36,14 +36,20 @@ Arrays: *We can use literals to assign values to arrays. *Demonstrate out of bounds errors by setting n to different values - e.g. a[n+15] = 11 // index out of bounds error since len is 10 + +``` +a[n+15] = 11 // index out of bounds error since len is 10 +``` *Efficient way to check n is in bounds: - assert!(n+20 < a.len()); // panics + +``` +assert!(n+20 < a.len()); // panics +``` *In the main function, the print statement contains the debug implementation {a :?}. -*Adding #, eg {a:#?}, invokes a "pretty printing" format, which can be easier to read. +*Adding `#`, eg `{a:#?}`, invokes a "pretty printing" format, which can be easier to read. Tuples: