Functions in SRON
Functions are the block of code which are used to perform a particular task. They make code more readable and easier to debug and understand. In SRON, this is how you can create your own function.
SRON's functions are highly optimized for great speed, efficiency and performance. If you ever think that you are repeating a particular line of code multiple times, then create a seperate function for it.
You can also set the argument types for the function, like this:
What if you want strict type checking such that if the passed argument is not same as the specified type, then code will not run. For this, SRON provides strict argument keywords:
SRON provides 6 strict argument keywords:
Int_s Double_s Char_s Bool_s String_s List_s
These keywords ensures that the argument being passed to the function is of the specified type otherwise error will rise.
SRON provides abundant amount of in-built functions to work on data efficiently and easily without explicitly code them.
Print functions
User input functions
Type conversions functions
Type check functions
Math functions
Char functions
List functions
Miscellaneous functions
Calling functions in sub-directories
Suppose this is your directory tree:
Now, if you want to call square.srb and cube.srb from Main.srb, then you have to use access operator '.' (dot), here is sample code :
Last updated