anoniscoding / yorlang

A programming language with yoruba language construct
https://anoniscoding.github.io/yorlang/
MIT License
450 stars 70 forks source link

Max min branch #50

Closed Harjacober closed 5 years ago

Harjacober commented 5 years ago

Adds Maximum and Minimum helper functions

o_kere_julo(Minimum)

o_kere_julo returns the minimum number in a list of numbers

o_tobi_julo(Maximum)

o_tobi_julo returns the maximum number in a list of numbers

both functions takes an array or numbers separated by a ',' as argument if the first argument is an array, the function automatically ignores the other arguments and computes the max or min number in the first argument array.

Usage

var max = o_tobi_julo(34, 22, 56, 24, 4)
max = 56
var min= o_kere_julo(34, 22, 56, 24, 4)
min= 4
var min= o_kere_julo([34, 22, 56, 24, 4])
min= 4
var max= o_kere_julo([34, 22, 56, 24, 4], 45, 545, 45, 445)
max= 56
all other arguments are ignored only the first array argument is recognized