Post-increment operator in function argument in Go, not possible? -


कैसे जाते हैं (1.2.1) में, यह काम करता है?

  पैकेज मुख्य आयात ("एफएमटी") func main () {var i = 0 i और lt; 10 {fmt.Println (i) i ++}}   

लेकिन यह (फंक्शन तर्क में वेतन वृद्धि ऑपरेटर के साथ) नहीं करता है?

  पैकेज मुख्य आयात ("एफएमटी") func main () {var i = 0 i और lt; 10 {fmt.Println (i ++)}}    

में जाओ, i ++ एक बयान है, अभिव्यक्ति नहीं है इसलिए आप किसी अन्य अभिव्यक्ति में इसके मूल्य का उपयोग किसी फ़ंक्शन कॉल में नहीं कर सकते हैं।

यह बाद के वेतन वृद्धि और पूर्व-वेतन वृद्धि के बीच अंतर को समाप्त करता है, जो भ्रम और बग का स्रोत है।

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -