i can pass “set variable to” block in a ‘if then else’ statement like this :
But how to do it here :
i tried this :
will it work ( i don’t know i am not able to connect to companion )
Sorry if that was DUMB.
i can pass “set variable to” block in a ‘if then else’ statement like this :
But how to do it here :
i tried this :
will it work ( i don’t know i am not able to connect to companion )
Sorry if that was DUMB.
this block is to return and not set something if a condition happened. But still you can set something in it using the do result block in the control blocks.
i was editing the First Post.
you Type freaking Fast.
Yes it will work but you must return something.As the base of this block is if then return and not if then do so you will need to return something from the do result block so it can be returned by the if then block ( if the condition went true )
i know both do the same work.
But here the Scenario and my Question both are Different.
But Still,
Thankyou for your Time.
Yes
@ADDYLIN you have studied conditional operator in cpp, and that can be used instead of if_then_else right? I hope now you got it
Sometimes in a procedure or another block of code, you may need to do something and return something, but for various reasons you may choose to use this block instead of creating a new procedure
From docs
Not yet, but definitely in future.
Don’t know.
You introduced me with 2 new terms which i heard for the first time.
i heard of C++
but today i came to know it’s also called Cpp
This makes me speak -
Knowledge is a vast ocean. What i know is infinitesimally smaller than what we don’t know.
Let me tell both usage of both blocks are different.
If then block with setting variable is useful when you have more than one thing to do and not return value to any variable.
Eg.
If (true){ alert('hi'); console.log('is true') }
This is the root procedure or function that returns nothing.
For second If then is one line statement mainly in programming language like.
const data = If (true){ return ' available' }else {return 'not available'}
Used this block when you want value in variable or procedure thats changes input According to data input.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.