Diference ?
7 posts • Page 1 of 1
Re: Diference ?
[ ] are used to enclose elements of an array.
example: scene.my.Array2 = [[x],[y],[z]]
{ } are used to enclose executable code which tell Thyme to execute the code when necessary.
example: var1 >= 3.14 ? {x=x+1}:{x=x-1}
( ) are used to enclose one or more arguments of a function, and are also used to enclose an index for reading the value of an array element (sadly, array elements cannot be directly written to in Thyme, only read).
examples:
_Func3(3.14);
scene.my.variable5 = scene.my.Array2(1);
This is not allowed: scene.my.Array2(1) = scene.my.variable5, although there are some work-arounds for writing to array elements.
example: scene.my.Array2 = [[x],[y],[z]]
{ } are used to enclose executable code which tell Thyme to execute the code when necessary.
example: var1 >= 3.14 ? {x=x+1}:{x=x-1}
( ) are used to enclose one or more arguments of a function, and are also used to enclose an index for reading the value of an array element (sadly, array elements cannot be directly written to in Thyme, only read).
examples:
_Func3(3.14);
scene.my.variable5 = scene.my.Array2(1);
This is not allowed: scene.my.Array2(1) = scene.my.variable5, although there are some work-arounds for writing to array elements.
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Diference ?
Arguments ?
can you tell a list of a arguments ? if not show me the ones you know
can you tell a list of a arguments ? if not show me the ones you know
- Skrubs
- Posts: 16
- Joined: Tue Mar 06, 2018 7:36 pm
Re: Diference ?
[] Describes arrays, or "multi variables" in other words.
pos = [0,0]
{} contains literal code that is executed when algodoo is told to do so.
Angle = {5}; <-Executes "5" everytime angle is needed, which just returns said number.
(e)=>{...}; <- executes the stuff in the {} whenever the event function is triggered by Algodoo.
() resembles mathematical paranthesis, i.e. (x+3)*5 = x*5+15, index arrays and parameters.
pos(0) would give you the X-Value of the position.
colorHSVA(3) would give you the A-Value of the color.
(e)=>{} allows algodoo to give you the "e-information" that the event generated.
math.vec.len(vel) passes the vel as a paremeter to the len function in algodoo.
pos = [0,0]
{} contains literal code that is executed when algodoo is told to do so.
Angle = {5}; <-Executes "5" everytime angle is needed, which just returns said number.
(e)=>{...}; <- executes the stuff in the {} whenever the event function is triggered by Algodoo.
() resembles mathematical paranthesis, i.e. (x+3)*5 = x*5+15, index arrays and parameters.
pos(0) would give you the X-Value of the position.
colorHSVA(3) would give you the A-Value of the color.
(e)=>{} allows algodoo to give you the "e-information" that the event generated.
math.vec.len(vel) passes the vel as a paremeter to the len function in algodoo.
- FRA32
- Posts: 229
- Joined: Wed Dec 03, 2014 9:51 pm
Re: Diference ?
@FRA32 -- I already explained all that to him. Didn't you read my message before repeating everything that I said?
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Diference ?
I did in fact read it, but wanted to present the answer in the way I understand it, along with more elaborate examples. I very much recognize your answer as informative aswell, but considering that Skrubs very likely never used a coding language before, many examples, along with explanations, can be very usefull.
- FRA32
- Posts: 229
- Joined: Wed Dec 03, 2014 9:51 pm
Re: Diference ?
No problem! You are correct that sometimes another person might have a different way to describe a technical subject which may help the student to understand it better.
Thanks for your input!
Thanks for your input!
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
7 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests