+ 1
Are all the programming languages having same names for the loops
2 Respuestas
+ 5
There are some different names out there. This is a "for x in ['a', 'b', 'c'] print(x)" loop in Lisp "(dolist (x '(a b c)) (print x))"
+ 1
No, though most high-level languages do support the for loop and do/while or while loops.
In Perl and some other languages there is do/until or until which runs a loop until the test is truthy. This is in contrast to normal do and do/while loops (in those languages) which run until the test is falsey.
Some languages also support labels and the go-to statement which can be used to simulate different loops. Some assembly languages use this style, but instead of a label to jump to you provide a line or memory address.
IDK about all of the different ways to loop in all languages, but I do know one special case: JavaScript. It has 3 unique loop methods, though they could easily be converted to other languages -- forEach, for (var in array), and for (var of array). for..in is index-based like a normal for loop and so is effectively a pseudonym for an incrementing loop. The for..of loop on the other hand is value-based so instead of an index you get the actual value.