3 ms·
>> Previous function example speicifes a return type, why doesn't this one? > Because the function doesn't return anything (e.g. is void), I guess. Have anoth
by StrawberryFrog 17y ago
>> Previous function example speicifes a return type, why doesn't this one?
> Because the function doesn't return anything (e.g. is void), I guess.
Have another look at it. Does "add" look to you in this context at all like a function that returns void?
printf("1 + 2 = %d\n", add(1, 2))
- nddrylliog 17y agoAnd now I feel very dumb. You were right :/ It's all fixed now, thanks a lot for reporting. (At first I thought that you thought that return type specification was non-optional, e.g. that it lacked "-> Void") About the other issues: are you really bothered by them? (e.g. the familiarity of the writing, etc.) I thought it'd be less boring, but I didn't mean it to annoying. EDIT: fixed the "strange little dots" and "compiler is your friend" parts.
- bonecandy 17y agoI think your writing was fine! I like seeing some style with programming talk :D
- StrawberryFrog 17y agoStriking the right tone is hard, and you can't please everyone. Personally, I like a slightly conversational tone, but it's easy to got to far with it, and it just becomes a waste of words. You're writing to please the reader, not the writer ( see http://news.ycombinator.org/item?id=875094 http://news.ycombinator.org/item?id=875094 ). E.g. "Foreaches. Foreaches is like.. a regular For that gave up alcohol, decided to shave daily, and bought a new suit. It's prettier, and more effective. " I've been programming in C# for years, I know foreach. It's a workhorse feature that I use daily. There are similar constructs in Ruby and PHP and others.