Page History
...
- For Each Loops
- Conditional Return Statement
- Service Modules
- Event Modules
- Unit Test Modules
- Unpacking (Added in 2.1.1)
Extended BASIC+ Syntax
...
For Each Loops
For each loops offer a convenient way to walk through a dynamic array from beginning to end. If you have an @FM delimited array, you can do this:
...
Code Block |
---|
For Each Value in MyValues using @STM setting Pos NewValues<Pos> = Value Next Value |
...
...
Conditional Return Statement
...
Note that this syntax should only be used for the stored procedure's final Return statement, not for returning from a gosub. Anchor
Service Modules
SRP has been a big advocate for organizing code into Service Modules: stored procedures in which the first parameter identifies a service to execute. Normally, this involves branching to gosubs, mapping the input variables, and making sure the stored procedure has enough parameters to cover all the services' needs. Here is a traditional example:
...
This statement is key to making unit tests work. When the evaluation fails, the SRP Editor will display the two values side by side for easy comparison. Anchor
Unpacking
IMPORTANT: Unpacking was added in 2.1.1 and is not supported in prior versions.
...