+ 1
Return
Помогите я часто вижу это в кодах но не знаю что такое return. ( изменено 2 ) Как использовать возвратное свойство, и что оно делает.
6 Answers
+ 6
Gfy Hgfh ,
i can imagine that you are confused by seeing these 2 `return` statements / spellings:
return x*2; and the other is return (x+y);
you can write it like shown here, all of them are correct:
return (x*2);
return x*2;
return (x+y);
return x+y;
> the parenthesis () are not required in our samples, so they may be used for a better readability or other purposes.
> but there are cases where we need to use parenthesis in calculations - they are giving an expression a *higher priority* as other expressions.
+ 5
"Help, I often see this in codes but I don’t know what it is"
'return' can be used to end a function and return the result of the function but it's exact usage may depend on which programming language you are using. Be sure to tag your questions with the programming language you're asking about or mention it in the question 👍
+ 4
Gfy Hgfh , you are welcome...
+ 3
Спасибо всем за ответ
+ 2
It is used to announce the final result of calculations in a function. Probably, you've just started learning, so don't worry it will be covered later in the course.
+ 1
Большое спасибо я бы наверное никогда бы не понял если бы вы не ответили