+ 1

Return

Помогите я часто вижу это в кодах но не знаю что такое return. ( изменено 2 ) Как использовать возвратное свойство, и что оно делает.

2nd Jan 2024, 6:26 PM
Gfy Hgfh
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.
3rd Jan 2024, 12:13 PM
Lothar
Lothar - avatar
+ 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 👍
2nd Jan 2024, 6:52 PM
Keith
Keith - avatar
+ 4
Gfy Hgfh , you are welcome...
3rd Jan 2024, 4:21 PM
Lothar
Lothar - avatar
+ 3
Спасибо всем за ответ
2nd Jan 2024, 7:39 PM
Gfy Hgfh
+ 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.
2nd Jan 2024, 7:26 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 1
Большое спасибо я бы наверное никогда бы не понял если бы вы не ответили
3rd Jan 2024, 3:30 PM
Gfy Hgfh