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