Popup YouTube Video
Sheerpower Logo

Using Modules for Further Code Segmentation


Consider an include file containing dozens of tax calculation routines. We might make a tax module filled with these common tax routines to make development and maintenance easier.
module taxes routine calculate_tax with amount, rate, returning tax_due tax_due = amount * rate end routine end module
To use this module, include it in your main source file with the %include directive. Once included, data and routines within the module are referenced by prefixing their names with the module name and a dot.
taxes.calculate_tax with amount cash, rate tax_rate, returning tax_due total_tax
Hide Description

    

       


      

Enter or modify the code below, and then click on RUN

Looking for the full power of Sheerpower?
Check out the Sheerpower website. Free to download. Free to use.