RE: FizzBuzz in 10 programming languages 07-08-2013, 07:57 AM
#11
(07-07-2013, 09:59 PM)noize Wrote: I'll change the class names (only one llitter's got to be uppercase, right?), though, it works this way too, is there any actual difference or is it just convention?
Convention only. http://www.oracle.com/technetwork/java/c...38413.html
To be exact, this is what the conventions say:
Quote:Class names should be nouns, in mixed case with the first letter of each internal word capitalized
Quote:The main function in C does *not* need a return statement: it's a void function. For the variable, yes, you're right.
Wrong. You even declared it as int main. You have to return the status code, 0 for success, another integer if an error happened.
Some compilers will allow you to have a void main, but that's against the standard of the language and you should avoid it at all costs.
Quote:Why is it odd to start a loop at 1? :huh:
Because most programmers do:
for i = 0; i < 100; i++
But actually I got it wrong here, as the FizzBuzz test states it should go from 1 to 100.
Quote:I'm not good with Python, you know, may I get a brief reason for what you're argueing?
range() creates a list that is saved in memory. xrange() is more like a generator. The numbers are only created when needed.
Quote:Edit: you know Prolog too?
Yes, I took two AI courses and there we used Prolog. It's a relatively easy language in the sense that it uses one algorithm for resolution and once you understood it, there isn't much else to know. (One of my professors wrote an interpreter for prolog in Haskell within a single lecture.)
But you need a very good understanding of mathematical logic. It is a logic programming language.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.
Expressed feelings are just an attempt to simulate humans.
![[Image: 2YpkRjy.png]](http://i.imgur.com/2YpkRjy.png)

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)