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