In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail about the use of linux's return command to exit from the function and return values. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The function of the return command is to cause the shell function to exit and return a numeric value. If no value of n is specified, it defaults to the return state of the last command of the function.
The return value is the value of the parameter n you specify. If you specify a parameter greater than 255 or less than 0, the return value will always be between 0 and 255 by adding or subtracting 256. Executing a return statement outside the function returns a failure.
As far as bash is concerned, return commands can only be used in functions, not directly in scripts.
The built-in command return is used to return from the function, and the return command is not necessary in the function. When the function is called, the command in the function will naturally return to the place where it is called (usually back to the main program). If there is a return command in a function, it is returned when it is executed to return. If return is not the last command in the function, the other commands that follow return are no longer executed.
Syntax format: return [parameters]
Common parameters:
Reference example
Define a function with a return value greater than 255:
[root@linuxcool ~] # example () {return 259} / / execute the function [root@linuxcool ~] # example// shows 3 [root@linuxcool ~] # echo $? 3
Immediately end the execution of this procedure:
Procedure checkstatusParameter nameif len (name) = 0 thenreturnelse?nameendifmessagebox ('hello') endproc
Returns null in a method with an object reference return type:
Public Button doStuff () {return null;} about using the return command of linux to exit from the function and return the value is shared here. I hope the above can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.