"Sputnik" help  
Sputnik Help
Prefix

Description

This demonstrates how to create a function that can insert statements to the beginning of another function.

Before reading this section make sure to read all User Functions and understand it.

Remarks

The prefix rule in Sputnik allows you to insert statements at the beginning of another function. By using the ^ flag, you can modify the behavior of a function by adding custom statements that execute before the original code.

With the prefix rule, you can enhance the functionality of a function by inserting additional actions or initialization steps at the start. This feature is useful when you want to customize the behavior of a function without directly modifying its original code.

By applying the prefix rule, you can seamlessly extend the functionality of a function and ensure that your custom statements execute before the main logic of the function. It provides flexibility and allows for modular code customization.

When using the prefix rule, it's important to consider the order of execution and the impact of the inserted statements on the overall behavior of the function. Make sure to test and verify that the function behaves as expected after applying the prefix rule.

The prefix rule is a powerful tool in Sputnik that enables you to tailor functions to your specific needs without requiring extensive modifications to the original code. It promotes code reusability and flexibility, making it easier to adapt functions to different scenarios and requirements.

Related

User Functions, Rule Suffix

Example

Example of appending statementes to the start of a function:

Function Test()
{
    say "Hello";
}

"^" Function Test()
{
    say "Cat";
}

say Test();

// PRINTS
// Cat
// Hello
As you can see the "^" flag made the second Test function insert its statements at the beginning of the original Test function.

Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org