Core Function Max

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> Max( <expression>, <expression2> ) </pre> === Description === Find the greater number and return it === Parameters === ==== expression ==== Any valid numeric expressio...")
 
Line 23: Line 23:
 
=== Remarks ===
 
=== Remarks ===
  
None.
+
You can add infinitely more expressions and compare them all to find the max
  
 
=== Example ===
 
=== Example ===
Line 30: Line 30:
 
$y = max(50, 100);
 
$y = max(50, 100);
 
println( "Value is: $y " ); //prints 100
 
println( "Value is: $y " ); //prints 100
 +
</syntaxhighlight>
 +
 +
// Example of comparing many values
 +
<syntaxhighlight lang="sputnik">
 +
$y = Max(1, 2, 7, 3, 4, 5)
 +
println( "Value is: $y " ); //prints 7
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:Core Function]]
 
[[Category:Core Function]]

Revision as of 08:34, 29 April 2013

Max( <expression>, <expression2> )

Contents

Description

Find the greater number and return it

Parameters

expression

Any valid numeric expression.

expression2

Any valid numeric expression.

Return Value

Compares 2 numbers and returns the greater number.

Remarks

You can add infinitely more expressions and compare them all to find the max

Example

$y = max(50, 100);
println( "Value is: $y " ); //prints 100

// Example of comparing many values

$y = Max(1, 2, 7, 3, 4, 5)
println( "Value is: $y " ); //prints 7
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox