How to store and save correct answers with a set of digits as response in Digit span task?

Sorry,

Should I change to both for which code of learn or response?!

I did not understand this:
change show_digits to snapshot on the right hand side to fix .thisN online.

Should I put nReps = len(list(str(digits))) in a Begin Routine of a code component for learn or response?

nReps for trials should probably be a number for learn loop or response loop?

You need to add a new routine to the left of your inner loop (show_digits) but inside your outer loop to check the number of digits so that the inner loop repeats the correct number of times.

Your outer loop (trials) should be set to 1 (unless you know why it should be something else).

I did but error:

Reattach your Excel files – ensuring they are in the same folder (or sub folders) of the experiment file

I added 0 to allowed keys however no number with 0 in file but still error :

Use the Browser console to work out which list is undefined.

the nReps for show_digits isn’t working. Please could you show the code where you set it and the loop again.

It might be worth trying a different variable name, eg nDigits

181 for (const thisShow_digit of show_digits) {
this is all for that line.

Sorry yes I saw you’d posted the line already and edited my response.

Try nDigits=len(digits)

Please confirm that this is happening inside the outer loop but before the inner loop starts.

And setting the nReps for the inner loop to nDigits

It might be worth trying a different variable name, eg nDigits in excel file? or nDigits instead of nReps in code?

I got confused with the two following sentences. could you clarify more?

Please confirm that this is happening inside the outer loop but before the inner loop starts.
And setting the nReps for the inner loop to nDigits

Is this do you mean?

Remove the loop around nDigits2

What code do you have in that routine?

nDigits=len(digits) in begin routine.

nReps (or nDigits) should be calculated in nDigits2 and the used in the digits loop

I faced the same error as before can not read the property (0)…

How about a different tack?

Delete that new routine.

Add a column called nDigits in your spreadsheet and enter the number of digits manually in your spreadsheet.

Put nReps as nDigits in the inner loop.

I did. Does it need to add a component for nReps?

did but the same error