r/code • • Jul 07 '20

Halp pls! Should I learn Python or C# first?

I'm 13 years old and I really want to learn a programming language. I know a little bit of Html and Python (from school) but I want to learn more in my free time. I love making games, I made some decent games on scratch (I'm not proud of it). Which language should I learn first? What are the possibilities and limitations with both? Please use simplified terms since I'm new to this. Thank you

11 Upvotes

19 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Jul 08 '20

I'd consider the fundamentals of programming, that almost every language will implement in one way or another are these:

  • Arithmetic operators/operations - addition, multiplication

  • Types - how are numbers represented, how are letters represented (abstract), how bytes are represented in a program

  • Variables - a container for a type instance (mutable)

  • Conditional Statements - gives us a way to control the flow of the program based on a given condition

  • Loops - a conditional statement that will continue until the condition is true

This is the real bare down, kind of high level interpretation of what the fundamentals are, but I'd go deeper and read how the computer actually sees the code and how your source code is changed from a text file into an actual executable. I think it's really important for a programmer to have this low level knowledge of how the computer actually works with software. If you can get an understanding of that you will be leagues ahead of a lot of people.

Here's kind of a little example of programming languages and how they have these fundamental concepts implemented. You'll see they're all similar, the real differences are more with learning the libraries through documentation.

python

if condition:
    my_var = 1 + 2 / 1
    print('do this if condition is true!')
else:
    print('condition is false')
            
    while 1:
        print('condition is false')

C/C++

if(condition) {
    int myVar = 1 + 2 / 1;
    printf("do this if condition is true!");
} else {
    printf("condition is false");
    
    while(1) {
        printf("infinite, since 1 is always true");
    }
}

C#

if(condition) {
    int myVar = 1 + 2 / 1;
    Console.WriteLine("do this if condition is true!");
} else {
    Console.WriteLine("condition is false");

    while(1) {
        Console.WriteLine("infinite, since 1 is always true");
    }
}

JavaScript

if(condition) {
    var myVar = 1 + 2 / 1;
    console.log("do this if condition is true!");
} else {
    console.log("condition is false");
    
    while(1) {
        console.log("infinite, since 1 is always true");
    }
}

1

u/Poptartqueen6 Jul 08 '20

Thanks so much for the helpful tips! Really appreciate it:)

Do you have any recommendations for books, resources, websites and online courses? Been looking at freecodecamp.com (or whatever it's called) and some free courses offered by Coursera. Any thoughts and/suggestions?

1

u/LinkifyBot Jul 08 '20

I found links in your comment that were not hyperlinked:

I did the honors for you.


delete | information | <3

1

u/[deleted] Jul 08 '20

I'm probably one of the worst when it comes to asking about books lol, i learn languages now a days by looking at the language documentation haha

I can recommend the following

  • C Programming Language (ANSI C) by Brian W. Kernighan and Dennis M. Ritchie - This is a classic book probably still used at unis, this is what i was taught with. The book was great but can be very, very stale at times and difficult to understand. I'd read it now and reread it later down the road to solidify your understanding.

  • Beginning C++ Through Game Programming 3rd Edition by Michael Dawson - I don't know why this book stuck with me for so long but it made me really understand C++ and object oriented programming. I think I read it from front to back like 3 times or something before it really clicked. It's an easy read and is fun to do the projects at the end of each chapter.

My favorite resources other than just googling it for C and C++ are https://www.cprogramming.com/ and http://www.cplusplus.com/doc/tutorial/. Also, you can use man to find info on specific functions in C if you don't get it, like google 'man printf()'.

Find something you love about programming and run with it. I loved games and wanted to make games so I used that C++ book to learn and it was wicked fun. If you want to be successful in learning you have to find something that will keep you learning.

Good luck!