The reason there are too many arguments, is that, there is a second comma in the While() function.
The structure of a While() function is
While( testExpr, bodyExpr )
Note: there are only 2 arguments to the function. The test
i_loop <= N_loop
and then the statements that are executed if the textExpr is true. Your bodyExpr has commas after each statement, rather than semicolons. Thus, making each statement a separate argument.
Please do not just change the commas to semicolons and run this code. There is a logic error, which will not allow the code to ever end. i_loop and N_loop never change in value.
There is also a faster way to check for the number of valid values in a column. Additionally, if you are deleting columns, and your N_loop value remains fixed, N_loop is no longer the correct number of columns in the data table, once one column is deleted. It is best to work from the last column to the first column in such cases.
Below is a rework of your script which will delete the columns where the number of valid data values is less than or equal to 8.
Names Default To Here( 1 );
dt_2 = Current Data Table();
N_loop = N Cols( dt_2 );
i_loop = 2;
While( N_loop > i_loop,
If( Col Number( As Column( dt_2, N_loop ) ) <= 8,
dt_2 << Delete Columns( N_loop )
);
N_loop -= 1;
);
P.S. @jthi solution is a better solution. Your approach, with some corrections, does work.....so good job!
Jim