1 ActionScript[ | ]
actionscript
Copy
var weekDays:Array = new Array( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" );
2 C++[ | ]

C++
Copy
#include <iostream>
using namespace std;
int main() {
char fruits[3][10] = {"apple", "banana", "cranberry"};
for(int i=0; i<3; i++) cout << fruits[i] << " ";
// apple banana cranberry
}
C++
Copy
#include <iostream>
using namespace std;
int main() {
string fruits[3] = {"apple", "banana", "cranberry"};
for(int i=0; i<3; i++) cout << fruits[i] << " ";
// apple banana cranberry
}
C++
Copy
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<string> fruits;
fruits.push_back("apple");
fruits.push_back("banana");
fruits.push_back("cranberry");
for(int i=0; i<fruits.size(); i++) cout << fruits[i] << " ";
// apple banana cranberry
}
3 C#[ | ]
C#
Copy
string[] stringArray = new string[6];
string[] weekDays = new string[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
string[] weekDays2 = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
4 Java[ | ]
Java
Copy
String[] weekDays = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
System.out.println(Arrays.toString(weekDays));
// [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
5 Objective-C[ | ]
Objective-C
Copy
NSArray *weekDays = [NSArray arrayWithObjects:@"Sun", @"Mon", @"Tue", @"Wed", @"Thu", @"Fri", @"Sat", nil];
6 Perl[ | ]
Perl
Copy
@weekDays = ( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" );
$weekDays_ref = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ];
7 PHP[ | ]
PHP
Copy
$weekDays = array( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" );
8 Python[ | ]
Python
Copy
weekDays = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]
9 Ruby[ | ]
Ruby
Copy
fruits = ['apple', 'banana']
print fruits
# ["apple", "banana"]
10 See also[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.