Understand it better, don’t get left behind

No matter how well explained coding is here in Grasshopper, some of us still find it difficult to understand and can get left behind not wanting to hold up the rest of the class, (if that was the case). It has happened to me and it still does, so, this topic section can be used for more practice and more questions for those of us who really need more expanining and work to do.

1 Like

When would you make banana bread? The second quiz at the “IF STATEMENTS” section, was and still is kind of hard to understand especially when a person like me just started learning to code. :grin: Dont feel bad simply ask!

I also need to understand where to find the values for seconds, hours, minutes, etc. There was an instruction to: Make the transition last 4 seconds by using .duration () and it looked like this
.duration(4000)
So if 4 seconds value is 4000 what would 49 minutes be? or what would 17 hours be?
Hopefully Im not asking too soon! Thank you in advance.

Hey @RayOTech,

For the .duration() function, it takes any amount of time in milliseconds, so:
4 seconds = 4,000 milliseconds .duration(4000)
49 minutes = 2,900,000 milliseconds .duration(2900000)
17 hours = 61,200,000 milliseconds .duration(61200000)
(Not sure of a case where you would want to have a transition that long but whatever floats your goat)

Hope this helps! :smile:

2 Likes

Hey @RayOTech,

Is there are particular aspect of the banana bread quiz you find confusing?

In this quiz, there is an if statement inside another if statement. This is a ‘stretch’ quiz because you’ve not be taught yet want happens in those scenarios. The quiz is aimed at getting you to start think about it.

When an if statement is inside another if statement, both if statement’s tests have to be true in order for the code in the inner if statement to run. The best way to read it is to check the first test, if it’s true go to the inner if statements test, if that is true then run the code inside the inner if statement.

If at any point a test is false, stop reading the code and move past the if statements (in this case there is no other code than the nested if statements).

The idea of ‘reading’ code to understand what the computer will execute in different scenarios is difficult (so don’t worry about struggling with it), but a common aspect of professional coding.

Hoping this helps!
H :slight_smile:

1 Like

Hi,
There is some basic math calculation you have to implement as per your code logic.
For time calculation find here:

1second = 1000 milliseconds
1minute = 60 seconds
1hour = 60 minutes
1day = 24 hours

you have to do some multiplication and bang your code is done!!!

2 Likes

Mystery guy I used those high duration times as examples not that Im gonna use them. Just trying to find out the values like in 4 secods = 4000. Im new to this and I still have a loooong way to go. But I really appreciate your time to reply! TY

1 Like

See? As in 1 sec = 1000 I just thought the value was different than the logical and only way. I know since the 1st grade that an hour is 60 mins, only that in coding I thought values were diferent, thats all. But K, I really appreciate your time! Thanks dude!

1 Like

Guys please understand this is my very first time wanting to learn to code… Seriously please understand if my questions are a certain way…!

1 Like

Sorry, I didn’t mean to sound demeaning or anything when I said:

I was just joking around. Although a New York ball drop animation that’s one year long would be pretty funny. :slight_smile:

It’s good that you’re taking the first steps towards learning how to code because they are definitely the hardest :smile:

1 Like