All or Nothing explainer

I’m not totally sure what I’m doing wrong. I’ve looked at all the feedback and I can’t figure out if there’s something in the wrong place or what.

Hey there,

The function takes a parameter, results, and loops through it, looking at each item one at a time. If one of those items is the string 'fail', the function will return the string 'failed'. Otherwise it will return the length of results.

When the function is called, it takes testResults as an argument.

In your code, testResults is being used where you should be using results. Change your for loop to this:

for (var element of results) {
    if (element === 'fail') {
        return 'failed';
    }
}

Then, at the end of the function:

return results.length + 'tests passed';

Hope this helps! Let me know if you have any questions.
Ben

1 Like

Thank you! That helps a lot! I completed it.

2 Likes

Guys, amazing task! Thank you for that!


_

Really got stopped for a few. It was the most hardcore puzzle since I started.

Can I ask? Why you (I mean app :)) doesn’t agree with another ways of solution?!

My first solution stopped by the program - as too much recombination in first code… So It makes me mad. It may be a little bit unhappy for another IT-brains I guess = to find another solution and got… Nothing! (Fantastic unbelievable unforgettable nothing) or restart of the task :). Why the Justice League didn’t say anything?

On the one hand, I realize, why needed only one-way-answer.

On the other… Avengers, help!

If program do what you need, and you’ve got 2 solutions or more - why not?

Sorry, If I’m too romantic, but - programming is a way to solve the problems. You may do it elegance or like dishes-dancing elephant, but you find ways to get whatever you needed. I mean, you may find a long field of difference solutions, so why we’ve learning to see just one?

(I understand, that answer from guru with great experience is not equal to new member.

But answer me, please:

  • Why don’t Grasshopper get more points - for 2 or more solutions? For me, It’s upset.

  • At level 1, while you reached Moon (!!!) after last exercise - would be better to get more animation. Like green popping + new colour or many colours. Maby more energetic music?

I tried to say: steps from exercise to exercise looks great, in compliance with Moon - they got 100 from 100. I love the idea of travel-game, so why we’ve got so silence on the top? It might be party hard ^^.

  • Last great thoughts:

The Grasshopper is amazing!
I dreamed about getting this magic experience… But can’t even imagine that it would be in so useful, fast, interesting, beautiful and comfortable way.
Thank you from all my heart!

P.S. Hope to see exercises in other languages or maybe just added here.

More interesting experience is to learn more: for instance, second programming language - to get parallel vision of them, life get colour :wink: with deep understanding the bright moment’s hesitation - when you realize how to do, and even better, also I love to complete puzzles. Once upon a time I heard that best brains could use 2 and more languages to get the best solutions. And languages for them are like instrument panel - both may be using, both do. But one of them could do… it with a sense of humour :slight_smile:

Remember: the right answer you even once didn’t get from me or others. Shame on you! (*I mean:)
42.

:exploding_head:

Glad you’re enjoying programming!
-Ben

1 Like

A post was merged into an existing topic: Split Up Evenly explainer

Issue with all or nothing no for loop otion. Or unable insert code from site…
emphasized text

Can you provide a screenshot ?

yes sir, Rich,

your my first contact with Arthropoda via grasshopper Suborder Mrs.Grace Hopper usn admiral .

About the ‘All or nothing’ sample:

I have used the reveal option to get a look at your coders working answer. write in down carefully and see or better understand the functions taking place…

I am on a LAPTOP at restaurant , Linux Freya.

i use the download lesson on smart phone with very limited wifi to check answer.

thanks to reply.

not able to put the for …loop code and make it look like the code on your reveal section of my qlink phone…

To avoid error’s in life, do nothing. Bet you can’t!

God Bless

Alright, that was deep. But can you please send a screenshot??

Richie lease reply to for loop not working to applying tips on all or nothing, lease assist

Install the grasshopper app on your phone and complete the puzzle there using the same account.

I am install on both. The all on nothing doesn’t take the code ,setup editing a (for… Loop the elements can change not the label var.

Hey there, don’t worry about changing the var. For loops in Grasshopper can’t be edited to remove the var. We’re looking into the issue, but for now, just use var in the for loop.

Ben

Please help

Hey there, move the return results.length down one line. Right now it’s inside your for loop.

– Ben

For …Loop , for ( let testResult of results)

I believe you are asking how to replace the ‘var’ with ‘let’ , right?
You can’t do that in the app but you can still complete the puzzle by using ‘var’…