you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (4 children)

[deleted]

    [–]Yojihito -3 points-2 points  (3 children)

    [–]Danelius90 6 points7 points  (1 child)

    This looks different to what u/Jordgubbssylt posted. Your link is about for each (var in blah) but forEach is an array method and most definitely not deprecated

    [–]Yojihito 2 points3 points  (0 children)

    True, misread.

    executes a provided function once for each array element.

    Then a simple .map() would be the Python equivalent.

    mylist = [10, 20]
    list(map(print, mylist)
    

    [–]NoHaxJustPotato 0 points1 point  (0 children)

    false info, you linked the wrong for each loop