Interesting way to write function
2 posts • Page 1 of 1
Interesting way to write function
scene.my.max := (a,b) => {[a, b](math.toInt(a > b))}
or
scene.my.max := (a,b,c) => {[a, b, c](a > b && a > c ? 0 : {b > a && b > c ? 1 : 2})}
It's not very useful in examples but you gon the point: [array](index)
Can became handy in complex "if - case" with many variants and multiple usage of one.
or
scene.my.max := (a,b,c) => {[a, b, c](a > b && a > c ? 0 : {b > a && b > c ? 1 : 2})}
It's not very useful in examples but you gon the point: [array](index)
Can became handy in complex "if - case" with many variants and multiple usage of one.
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Interesting way to write function
I don't think this notation is not good to understand, but is interesting.
["a",["b",["c", "d"]],"e"] 1 1 0 returns "c".
(NOTE: I don't recommend to reducing (). )
["a",["b",["c", "d"]],"e"] 1 1 0 returns "c".
(NOTE: I don't recommend to reducing (). )
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-

tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
2 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 4 guests



