Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
Python
JavaScript
Java
C++
myFruits = ['banana','apple','orange'] for fruit in myFruits: print(fruit) #Python
const myFruits = ['banana','apple','orange']; for (let fruit of myFruits) { console.log(fruit); } //JavaScript
public class Main { public static void main(String[] args) { String[] myFruits = {"banana", "apple", "orange"}; for (String fruit : myFruits) { System.out.println(fruit); } } } //Java
#include
using namespace std; int main() { string myFruits[] = {"banana", "apple", "orange"}; for (auto fruit : myFruits) { cout << fruit + "\n"; } return 0; } //C++
Python result:
JavaScript result:
Java result:
CPP result:
banana
apple
orange
banana
apple
orange
banana
apple
orange
banana
apple
orange