Python return 關鍵字
定義和用法
return
關鍵字用於退出函式並返回一個值。
更多示例
示例
return 行之後的語句將不會被執行
def myfunction()
return 3+3
print("Hello, World!")
print(myfunction())
自己動手試一試 »
相關頁面
使用關鍵字 def
定義一個函式。
在我們的Python 函式教程中閱讀更多關於函式的資訊。
return
關鍵字用於退出函式並返回一個值。
return 行之後的語句將不會被執行
def myfunction()
return 3+3
print("Hello, World!")
print(myfunction())
自己動手試一試 »
使用關鍵字 def
定義一個函式。
在我們的Python 函式教程中閱讀更多關於函式的資訊。
如果您想將 W3Schools 服務用於教育機構、團隊或企業,請傳送電子郵件給我們
sales@w3schools.com
如果您想報告錯誤,或想提出建議,請傳送電子郵件給我們
help@w3schools.com