Programming

blov · · 554 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Here&#39;s my problem with learning programming. I understand all the basics. I understand variables, arrays, pointers , loops, deference, incremental, and so on, but I can seem to come up with the words to write a program. How do I come up with those words? For example<br/> contract mortal { /* Define variable owner of the type address*/ address owner;</p> <pre><code>/* this function is executed at initialization and sets the owner of the contract */ function mortal() { owner = msg.sender; } /* Function to recover the funds on the contract */ function kill() { if (msg.sender == owner) selfdestruct(owner); } </code></pre> <p>}</p> <p>contract greeter is mortal { /* define variable greeting of the type string */ string greeting;</p> <pre><code>/* this runs when the contract is executed */ function greeter(string _greeting) public { greeting = _greeting; } /* main function */ function greet() constant returns (string) { return greeting; } </code></pre> <p>}</p> <hr/>**评论:**<br/><br/>shovelpost: <pre><p>Well first of all this doesn&#39;t look like Go code.</p> <blockquote> <p>but I can seem to come up with the words to write a program. How do I come up with those words?</p> </blockquote> <p>What words? What are you talking about?</p> <p>You learn the basic keywords of the language. For example in Go when you want to make a struct you use <code>type XXX struct</code>.</p> <p>If you are talking about words used to name the XXX struct the that depends entirely on the problem you are trying to solve.</p></pre>epiris: <pre><p>It looks like you need to familiarize yourself with the Go syntax. Luckily it&#39;s the simplest language syntactically you&#39;re going to find. the golang tour and gobyexample.com site should get you up and running in no time.</p></pre>gott_modus: <pre><blockquote> <p>Luckily it&#39;s the simplest language syntactically you&#39;re going to find.</p> </blockquote> <p>Bro, do you even Python? Can you Lisp, dawg? </p> <pre><code> Hey guys I come from Python what&#39;s this star thingy it crashed my code </code></pre></pre>Killing_Spark: <pre><p>Hey guys i come from go and i copied some code from stackoverflow with weird indentation and it crashed my program</p></pre>gott_modus: <pre><p>C&#39;mon: you can do better than that.</p></pre>comrade_donkey: <pre><p>Hello, I come from PHP and what&#39;s this bitcoin thing? It says if I don&#39;t pay they won&#39;t give me back my MySQL server. Also, why do I have to restart Apache every hour?</p> <p>Hi I come from Haskell and why is my monoid in the category of endofunctors slow?</p> <p>Howdy I&#39;m a corporate enteprise vice executive Java development engineer and do I really need my IntCreatorFactoryServiceProviderInterface?</p></pre>gott_modus: <pre><p>Well, my point was that Go isn&#39;t the simplest syntactical language out there. Java is probably the simplest, if only because Python has weird semantics with scoping and major power features, etc</p></pre>__crackers__: <pre><p>Python&#39;s rather more complex than Go these days, tbh. </p> <p>Decorators, iterators, generators, coroutines, metaclasses.</p> <p>It is higher-level, though.</p> <p>Lisp, well, I just can seem to get my head around it. One day, though, and on that day I shall be enlightened.</p></pre>gott_modus: <pre><p>With Python you don&#39;t have to worry about memory addressing, though. And the code is fairly terse. To each their own, of course.</p></pre>ChristophBerger: <pre><blockquote> <p>How do I come up with those words?</p> </blockquote> <p>Tip: Read and learn from existing code. Tip inside the tip: Have a look at <a href="http://rosettacode.org/wiki/Rosetta_Code" rel="nofollow">rosettacode.org</a>. They collect code for all sorts of algorithms, data structures, etc. and for all sorts of languages.</p> <p>Here is the <a href="http://rosettacode.org/wiki/Category:Go" rel="nofollow">Go category</a>, or browse the <a href="http://rosettacode.org/wiki/Category:Programming_Tasks" rel="nofollow">Programming Tasks</a>, or do a search for the particular example you are interested in.</p></pre>gopher1717: <pre><p>If you want to learn the language, take a look at these two very simple tutorials:</p> <ul> <li><a href="https://tour.golang.org/welcome/1" rel="nofollow">Go Tour</a></li> <li><a href="https://gobyexample.com/" rel="nofollow">Go by Example</a></li> </ul></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

554 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传