I am making a telegram bot where i am receving data from api call. the api is returning me data like this
articles is the array and i want to retrive all the news from this .
when i do it without loop it work fine with no error
But when i am trying to print all data from array in look see below image
it gives me error like this (see in image)
How to print this data?
2
Answers
By the logic, i will tell "i" go to far away, but to be sure to not have any error, juste check if
newData.articles[i].source.name
is defined in a "if", if it’s true, you assigned to your variables and send the message, if not, just go nextFirst Check the
newData.articles[i].source
is definedChange Your
for
loop Like this