ગો (પ્રોગ્રામિંગ ભાષા): આવૃત્તિઓ વચ્ચેનો તફાવત

Content deleted Content added
No edit summary
No edit summary
લીટી ૩૮:
 
[[C++(પ્રોગ્રામિંગ ભાષા)|C++]] અને [[જાવા(પ્રોગ્રામિંગ ભાષા)| જાવા]]ની વિપરીત "ગો"માં વારસાઈ(Inheritance),સામાન્ય પ્રોગ્રામિંગ, મેથડ ઓવરલોડિંગ,પોઇન્ટર અંકગણિત જેવી સુવિધાઓ નથી.શરૂઆતમાં, ભાષામાં અપવાદ હેન્ડલિંગનો સમાવેશ થયો ન હતો,પણ માર્ચ 2010 માં એક પદ્ધતિ <code>panic</code>/<code>recover</code> અસાધારણ ભૂલોને નિયંત્રિત કરવા માટે અમલમાં મુકાઇ હતી.
 
 
==પ્રકારનું સિસ્ટમ==
 
'''ગો''' પ્રોગ્રામરને એવા કર્યો લખવા માટે પરવાનગી આપે છે જે કોઈપણ મનસ્વી ઇનપુટ પર કામ કરી શકે છે, પણ તે કાર્યોનું વિવરણ ઇંટરફેસમાં અમલ હોવું જોઇએ.
ગો ઈન્ટરફેસ પદ્ધતિઓનો સમૂહ તરીકે વર્ણવવામાં આવે છે, એક નામ અને સિગ્નેચર દ્વારા ઓળખાય છે.એક પ્રકાર માટે ઈન્ટરફેસ અમલમાં માનવામાં આવે છે જો તમામ જરૂરી પદ્ધતિઓ તે પ્રકાર માટે વ્યાખ્યાયિત થયેલ છે.એક ઇન્ટરફેસ માટે અન્ય ઈન્ટરફેસો "એમ્બેડ" જાહેર કરી શકાય છે જ્યારે અન્ય ઈન્ટરફેસોની વ્યાખ્યાયિત પદ્ધતિઓનો તેમાં સમાવેશ હોય છે.<ref name="memmodel">{{cite web| url = http://golang.org/doc/effective_go.html#interfaces_and_types | title = Effective Go - Interfaces and methods & Embedding | publisher = Google | accessdate =28 November 2011}}</ref>
Line ૭૭ ⟶ ૭૫:
*gccgo,એક GCC ફ્રન્ટએન્ડ [[C++(પ્રોગ્રામિંગ ભાષા)|C++]]<ref>{{cite web|url=http://golang.org/doc/go_faq.html#Implementation|title=FAQ: Implementation|date=16 January 2010|work=golang.org|accessdate=18 January 2010}}</ref> માં લખાયેલ છે.<br />
બંને કમ્પાઇલરોનો યુનિક્સ જેવી સિસ્ટમો પર કામ કરે છે અને તેની મોટા ભાગની લાઈબ્રેરીઓ વિન્ડોઝ પર પણ કામ કરે છે.
 
==ઉદાહરણો==
===હેલો વર્લ્ડ===
નીચે "હેલો વર્લ્ડ"નો પ્રોગ્રામ છે:
<syntaxhighlight lang="go">
package main
 
import "fmt"
 
func main() {
fmt.Println("Hello, World")
}
</syntaxhighlight>
"ગો"ના સ્વયંસંચાલિત અર્ધવિરામ નિવેશ લક્ષણના કારણે પ્રારંભિક કૌંસ પોતાની લીટીમાં હોવા જરૂરી નથી,એટલા માટે આ કૌંસ શૈલી વાપરવામાં આવે છે.<ref>{{cite web|url=http://golang.org/doc/go_tutorial.html|title=A Tutorial for the Go Programming Language|work=The Go Programming Language|publisher=Google|accessdate=10 March 2010|quote=The one surprise is that it's important to put the opening brace of a construct such as an if statement on the same line as the if; however, if you don't, there are situations that may not compile or may give the wrong result. The language forces the brace style to some extent.}}</ref>