Comments का उपयोग
Comments मनुष्यों के लिए notes हैं जिन्हें Lua program चलते वक्त ignore करता है।
In this page:
Comments
एक single-line comment दो dashes से शुरू होता है और line के अंत तक रहता है। एक block comment --[[ से शुरू होता है और ]] से खत्म होता है। Comments code explain करने या इसे temporarily disable करने के लिए इस्तेमाल हो सकते हैं।
Note:
Opening में एक और dash add करना, जैसे ---[[, एक single character से block comment बंद कर देता है।
उदाहरण: Comments
-- this is a single-line comment
print("visible") -- comment after code
--[[
print("this line is commented out")
print("and so is this one")
]]
--[==[ a block that may contain ]] safely ]==]
print("done")
-- Output:
-- visible
-- done
Login to try C/C++/Java/PHP code in the editor
आम गलतियां
- दूसरी languages की तरह comments के लिए // या # इस्तेमाल करना
- एक block comment का closing ]] भूल जाना
- level markers जैसे --[=[ इस्तेमाल किए बिना block comments nest करना
चैप्टर सारांश
- -- एक line comment शुरू करता है
- --[[ ]] एक block comment बनाता है
- Comments को Lua ignore करता है
- --[==[ जैसे level markers comments के अंदर ]] allow करते हैं
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: