0
Having a conversion error in my function. I want to reuse it to find array lengths.
conversion error from string to int. the original non function code in comments at the bottom works, but having issues creating my function. https://code.sololearn.com/ceAHngJm1y6N/?ref=app
6 Answers
+ 2
All variables are global. I modified your code, tell me if this code work for you or if you need something else.
https://code.sololearn.com/cVb6cv7iE9Ta/?ref=app
+ 1
Hi Gordie, I think is easier than that. If you use the function parameters to pass the array, function will work for any case. But right now array is a global variable, so you only need the index of the array.
0
That code have some errors. What do you need exactly? If I run the commented code, I had the answer: 3. And that is not the length of the string
0
The commented code isn't the current issue (and the string array alien has three elements. thus, 3.). ArLen is meant to do what the commented code does and output the resulting number to a variable. there's a conversion error. I'm sure I need to find a new way around it. I just want a function so I can reduce repeating my code.
0
Thank you, Dany and Gordie. I'm looking to actually take the length from an array and use it to influence another variable pointing to a different array. I think maybe it might work better once I figure out classes and objects! Thank you very much :)