Methods with multiple return values


Dear Mad Scientists,
Does SK have a modulus operator? % is already a reserved symbol.

As an alternative, I am trying to use the MathLib.fmod method, it is described as having two return values.
How would I go about accessing the remainder return value? I believe I saw mention of it somewhere, it had to do with binding a variable using : but I am unsure of the syntax.


Yes, it is mod() in the Integer class.

So you would use it like:

// returns 34

The methods in MathLib can also be used though they come from UE4 and might not be as optimized for use with SkookumScript.


Thank you for the reply!
I am a bit embarrassed to have missed that. :sweat_smile:


Though the Integer@mod() is the way to go here, to answer your question about multiple return values, SkookumScript has a mechanism called return arguments that you can read about in the Primer in the docs.

Blueprints and UE4 use references for return values (and SkookumScript can use this too).

The MathLib.fmod() method would be called like this:

!remainder: 0.0 // Initial value to modify in call
!result: MathLib.fmod(1234 100 remainder)
println("remainder: " remainder " result: " result)

and it would print out:

remainder: 34.0 result: 12