Return statement là gì?
Phrase
Programming
- ★
- ★
- ★
- ★
- ★
Câu lệnh return
Câu lệnh return kết thúc việc thực thi một hàm (function). Một câu lệnh return có thể trả về một giá trị (value).
int factorial(int n)
{
if(n == 0)
{
return 1; // return statement
}
int f = 1, i;
for(i = n; i > 0; i-- )
{
f = f * i;
}
return f; // return statement
}
Learning English Everyday