Can't understand code


Joined
Jun 5, 2022
Messages
1
Reaction score
0
Hello everyone!
I am kind of new in programming and I have some troubles learning and I was wondering; is programming really for everyone?
I am 19 years old and I've been mostly editing codes rather then making own (with no intention of stealing but just messing around to have fun).
I've tried learning coding from a lot of websites and courses but I just can't seem to understand how the code works. I know like small basics of javascript and python which I'm trying to learn.
I think I have 2 major problems.

My 1st biggest problem is that I can't keep concentration and because of it, i guess, I can't understand how it works, it's more like I remember how the part of a code looked and I just rewrite it as I don't understand always how to do it myself.

My 2nd biggest problem is that I lose motivation really fast in learning becase of the first problem and it's really frustrating. I started "learning" these two languages 2-3 years ago and I've started all over again like 10 times in total.
I just started it again 2 days ago and I just can't keep focusing and it really makes me wonder is coding for everyone?

I want to mention that I consume weed on daily bases (usually before going to sleep). I guess my head is in clouds all day long even if I'm not high at the moment.
Does anyone have experience in coding while smoking weed?

I'm willing to change my habbits if it really means that I actually can code and that i'm capable to learn how it works.
I THINK i am a bad problem solver which might be bad for programming as it's basically based on problem solving when it comes to debugging.
Is there a way to train myself to be a better problem solver?

I am greatfull for every response and answer!

P.S. Sorry for my bad grammar :)
 
Ad

Advertisements

Joined
May 11, 2022
Messages
58
Reaction score
5
yeah i'd say programming isn't for everyone. it's really only for mathematicians, and those good at puzzle solving.
 
Ad

Advertisements

Joined
Mar 28, 2022
Messages
75
Reaction score
8
Study Object Oriented Programming. The gist of it is to package basic ideas into bundles and deal with the details in a separate part. Divide and Conquer. Also, comments are an important part of communicating between you the writer of code and you the reader of that code a couple weeks down the line. And finally, name variables and functions so their name explains their purpose as much as possible.

Java:
/* This program gets two numbers from the user, adds them up, and displays the total */
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {

    // Get two numbers from user to add together
    int firstNumber  = getNumber(); // <--- Dealing with actually getting number later on
    int secondNumber = getNumber();

    // add them together
    int total = firstNumber + secondNumber;

    // display the result
    printNumber(total); // <--- Dealing with the specifics of printing a number in more detail in a separate function

  } // main

  /**
   * getNumber
   * @return number gathered from user input
   */
  static int getNumber(){
    // scanner for reading input
    Scanner input = new Scanner(System.in);

    System.out.print("input an integer ");
    int number = input.nextInt();
    return number;
  }

  /**
   * printNumber
   * print a number to the console
   * @param number to print
   */
  static void printNumber(int number) {
    System.out.println(
      String.format("number is %s", number)
    );
  }
} // Main
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top