Last active
August 30, 2016 08:02
-
-
Save JustinSDK/cd6eb5ce723f4b991998823b6038c4fb to your computer and use it in GitHub Desktop.
OpenSCAD max
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function maximum(lt, num = 0, index = 0) = | |
index == len(lt) ? num : ( | |
lt[index] > num ? maximum(lt, lt[index], index + 1) : maximum(lt, num, index + 1) | |
); | |
echo(maximum([1,3,5,7,6,4,2])); | |
echo(max([1,3,5,7,6,4,2])); // OpenSCAD 內建的 max 函式 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment