Match/switch expression
### Description I would like to request a match/switch statement feature for Typst. This would allow me to write conditional expressions that match a value against a set of patterns and execute different code blocks accordingly. ### Use Case take Rust for example: ``` match x { x if x < 2 => println!("x is less than 2"), x if x < 4 => println!("x is less than 4"), x if x < 6 => println!("x is less than 6"), x if x < 8 => println!("x is less than 8"), _ => println!("x is greater than or equal to 8"), } ``` it's better than writing a long if-else-if chain
Posted by 8LWXpg on May 24, 2023, 2:36 PM
Tags
Related issues
- struct's lifetime requirements can be bypassed via covariant field assignment
- Proposal to Reorganize the Moderation Team and Review Moderation Policies
- Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
- proposal: container/...: generic collection types
- Better Custom Endpoint BYOK
- A concrete policy for backward compatibility until Godot 5.0
Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments
github (Other)
struct's lifetime requirements can be bypassed via covariant field assignment
Proposal to Reorganize the Moderation Team and Review Moderation Policies
Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
proposal: container/...: generic collection types
Better Custom Endpoint BYOK
A concrete policy for backward compatibility until Godot 5.0
New MTP models not supported
Tracking: 429 / Capacity Issues
Match/switch expression
### Description I would like to request a match/switch statement feature for Typst. This would allow me to write conditional expressions that match a value against a set of patterns and execute different code blocks accordingly. ### Use Case take Rust for example: ``` match x { x if x < 2 => println!("x is less than 2"), x if x < 4 => println!("x is less than 4"), x if x < 6 => println!("x is less than 6"), x if x < 8 => println!("x is less than 8"), _ => println!("x is greater than or equal to 8"), } ``` it's better than writing a long if-else-if chain
Comments (0)
No comments yet. Start the discussion.