| 작성자 | AngryVGN | ||
|---|---|---|---|
| 작성일 | 2010-03-28 22:14:31 KST | 조회 | 262 |
| 제목 |
겔럭시 에디터 대비 공부.
|
||
if구문
if (RandomInt(1, 3) == 1) // Brace required
{
Print("Good");
}
else if (Random(1, 5) < 4) // else if
{
Print("Average");
}
else
{
Print("Bad");
}
while구문
int i = 0; // 정의와선언(?)을 동시에 할 수 있음.
while (i < 5)
{
Print(i);
i += 1; // Short hand for i = i + 1
} // Prints 0 1 2 3 4
변수구문
int a; // 변수 선언
int b = 1; // 변수 정의&선언.
const int c = 2; // const 구문을 붙이면 그 변수는 값 변경 X
// 변수는 무조건 항상 함수 맨 위에다가 해야함.
배열구문
const int array_count = 5;
int i = 0;
int[array_count] t; // C언어랑 틀림.
while (i < array_count)
{
t = i;
i = i + 1;
}
struct구문
struct point2d
{
int x;
int y;
}; // >> ; << 이거 잊으면안됨.
point2d A; // point2d타입 변수 선언.
A.x = 2;
A.y = 3;
print(A.x);
point2d* B = &A; // A 포인터 값 얻기.
Print(B->x);
함수구문
int plus(int i, int j)
{
int result = i + j; // 지역변수를 인자로 초기화.
return result; // result 변수값 리턴.
}
static void private()
{
// 이 함수는 오직 파일 사이에서 불러올 수 있다. (이유는 "static" 이라서.)
}
// 함수 프로토타입.
native int AIGetRawGasNumSpots (int player, int town);
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
© PlayXP Inc. All Rights Reserved.