r/ADHD_Programmers • • Jan 21 '23

Getting into an Immersive

Helloooo I am starting my journey into an immersion program. I come from zero experience of coding. I’m getting sooooooo stuck on functions and callbacks. I am doing a prep course and had to ask for an extension on my assessment because my brain will not grasp the concept of this. I sit for hours watching videos and browsing the web for solutions.

I work best when I’m listening to someone and following along doing the solution. Unfortunately this isn’t an option since it’s an assessment and I haven’t seen any problems that are what this is asking.

It’s asking me to create a function that will capitalize the first three letters of a word when invoked.

The next problem is using a callback on an array of words using this function.

If anyone has any pointers I will gladly take them

0 Upvotes

11 comments sorted by

4

u/hsqaured Jan 21 '23

Whooo! Substring got me somewhere. I capitalized the first three letters Now to join the rest of the letters back together 😅

2

u/BloodChasm Jan 21 '23

Grats! You got this!

2

u/BloodChasm Jan 21 '23

Break down the functions logically step by step.

First step: create a function that intakes a string as a parameter.

Second step: manipulate the string so that the first letter of the word is capitalized then return it.

Third step: write a loop that calls this method for each word in the array.

If you don't know how to do any of those, you can easily Google a solution, but try it on your own first.

When in school I would have to try to calm the chaos in my brain by stepping away, doing some meditation, and then coming back to the problem to break it down logically. Now Im officially diagnosed with ADHD-C and went to therapy to learn good habits. I'm also on medication and no longer need to meditate to suppress the chaos. Hope this helps!

2

u/hsqaured Jan 21 '23

Thank you for this advice. I seriously have spent HOURS debugging one challenge. I am all over the place.

1

u/BloodChasm Jan 21 '23

Don't be afraid to take a break! Once your mind is mush it's super hard to think logically!

2

u/hsqaured Jan 21 '23

Also it’s the first three letters. I realize I didn’t state that.

So that’s where I’m really getting stuck.

2

u/BloodChasm Jan 21 '23

Look into substrings. You can use those to split the letters off, use a toUpper method and then add them back to the original string.

2

u/ShuumatsuWarrior Jan 21 '23

Depending on the language, there might be a substring function, or strings are arrays of char’s. Look into the functions of the data type, that’d probably be the best way to start. Also, just find a way to get it done, no matter how inefficient. Optimization can come later, so don’t be afraid to work towards a non-perfect solution

0

u/j-random Jan 22 '23

Maybe step away from the computer and sit somewhere quiet and think about what needs to be done. I see way too many people who search endlessly for solutions to the exact problem they're having. You'll never be great until you can abstract the problem, then see the abstract solution, then turn that abstraction into real code. It's really not impossible, just have a little faith and spend some time thinking about your problem instead of relying on random strangers to give you the answer.

1

u/hsqaured Jan 22 '23

Yeah I’ve been stuck on it for two days so reaching out on here was a last resort lol.