packages - Introduction to packages in Sncode.
A package is a container that may be used to group a set of related symbols (functions, constants, classes) together.
Package declaration must begin with the keyword
package, followed by its name, and must end with the keyword
Package names can contain either letters
_ but cannot begin with a number. It is recommended to avoid numbers and use the UpperCamelCase convention to name your packages.
package Exemple e = "!"; function hello() return "Hello "; endf function world() return " World"; endf endp
In order to use a package that is in another file, you have to import it using the
To call a function defined in a package, you have to use the operator
:: between the package name and the function name:
a = Exemple::hello() .+ Exemple::world() .+ Exemple::e;
Calling a symbol (variable or function) from the same package :
package A function f1() return "f1"; endf function f2() return A::f1() .+ ", f2"; endf endp
Written by Jean-Georges Guenard, <firstname.lastname@example.org>Edit
© 2021 extenso Inc. All rights reserved.