diff --git a/components/ui/Doc.tsx b/components/ui/Doc.tsx index c66aa77..534d87f 100644 --- a/components/ui/Doc.tsx +++ b/components/ui/Doc.tsx @@ -93,7 +93,7 @@ export const A: React.FC = ({ children, href }) => ( export const Pre: React.FC = ({ children }) => (
-
+    
       {children}
     
diff --git a/components/ui/StackBox.tsx b/components/ui/StackBox.tsx index 78bc052..dcc7413 100644 --- a/components/ui/StackBox.tsx +++ b/components/ui/StackBox.tsx @@ -27,13 +27,15 @@ export const StackBox: React.FC = ({
- {p.trim().replace(/\\\|/g, '|')} + + {p.trim().replace(/\\\|/g, '|')} +
))} diff --git a/docs/libfuncs/array_get.mdx b/docs/libfuncs/array_get.mdx index 0dbe494..fbcca4f 100644 --- a/docs/libfuncs/array_get.mdx +++ b/docs/libfuncs/array_get.mdx @@ -5,15 +5,20 @@ fallthroughBranch: 'rangeCheck | element' statementBranch: 'rangeCheck' --- -## Description +# Description Gets an array element at a given index, handling out-of-range scenarios with a Statement branch. -## Syntax +# Syntax -`array_get([rangeCheck]: RangeCheck, [array]: Array, [index]: usize) { fallthrough([rangeCheck]: RangeCheck, [element]: Box), ([rangeCheck]: RangeCheck) }` +``` +array_get([rangeCheck]: RangeCheck, [array]: Array, [index]: usize) { + fallthrough([rangeCheck]: RangeCheck, [element]: Box) + ([rangeCheck]: RangeCheck) +} +``` -## Invoke Refs +# Invoke Refs | Name | Description | Type | | :------------: | :------------------------------- | :----------: | @@ -21,22 +26,26 @@ Gets an array element at a given index, handling out-of-range scenarios with a S | `[array]` | The array to read | `Array` | | `[index]` | The index of the element to read | `usize` | -## Output Refs +# Output Refs -### Fallthrough Branch +## Fallthrough Branch | Name | Description | Type | | :------------: | :--------------------------------------- | :----------: | | `[rangeCheck]` | The updated RangeCheck | `RangeCheck` | | `[element]` | A pointer to an element at a given index | `Box` | -### Target Statement Branch +## Target Statement Branch | Name | Description | Type | | :------------: | :--------------------- | :----------: | | `[rangeCheck]` | The updated RangeCheck | `RangeCheck` | -## Example 1 +# Examples + +## Example 1 - Fallthrough branch + +Reading the element at index 1 from an array of 4 elements. `array_get([rangeCheck], [array], [index]) { fallthrough([rangeCheck], [element]) 59([rangeCheck]) }` @@ -66,7 +75,14 @@ Gets an array element at a given index, handling out-of-range scenarios with a S | `rangeCheck` | 141 | | `element` | 146 | -## Example 2 +## Example 2 -Statement branch + +``` +array_get([rangeCheck], [array], [index]) { + fallthrough([rangeCheck], [element]) + 59([rangeCheck]) +} +``` ### Memory