nsk@Switch
Comprehensive documentation on conditional rendering using nskSwitch.
Introduction
The nskSwitch
environment in Neural Sketch provides a powerful yet intuitive way to conditionally render content based on a specified operand, closely mirroring the familiar concept of a "switch-case" construct found in many programming languages. This functionality significantly simplifies the process of generating dynamic, multi-state diagrams, ensuring flexibility while maintaining readability and simplicity.
Syntax
The environment accepts an optional argument [<options>]
and a mandatory operand argument {<operand>}
:
Parameters
- options
[optional]
: A set of key-value pairs to configure global rendering behavior. - operand
{mandatory}
: The value to test against case conditions defined within the environment.
Basic Usage
A basic implementation of nskSwitch
might look like:
Example: Dynamic Diagram
Here's an illustrative example showcasing conditional rendering based on the diagram state:
Comphrensive Guide
For a Comprehensive usage, please check Conditional Rendering
Reference
Prop | Type | Default |
---|---|---|
type? | choice | string |