r66
r1
1[[../|상위 문서]]
r3
2[[../include 결과|결과 보기]]
r1
3== 변수 a=1 ==
r35
4 * 기본형식 : a==1
r34
5{{{#!wiki style="word-break: keep-all;"
r28
6||<table bgcolor=transparent,transparent> 구분 || a= || +a= || -a= || 'a'= || "a"= || \[a\]= [* if 조건문을 \[a\]==1 식으로 걸어놓음.] || \[a=\][* if 조건문을 \[a==1\] 식으로 걸어놓음.] || calc(a)= || calc(+a)= || calc[a]= || calc[+a]= || calc['a']= || @@_@a@= ||
7|| ==1[* 단, -a= 열에는 if 조건문을 -a==-1 으로 걸어놓음.] || {{{#!if a==1
8출력}}} || {{{#!if +a==1
9출력}}} || {{{#!if -a==-1
10출력}}} || {{{#!if 'a'==1
11출력}}} || {{{#!if "a"==1
12출력}}} || {{{#!if [a]==1
13출력}}} || {{{#!if [a==1]
14출력}}} || {{{#!if calc(a)==1
15출력}}} || {{{#!if calc(+a)==1
16출력}}} || {{{#!if calc[a]==1
17출력}}} || {{{#!if calc[+a]==1
18출력}}} || {{{#!if calc['a']==1
19출력}}} || {{{#!if @a@==1
20출력}}} ||
21|| =='1' || {{{#!if a=='1'
22출력}}} || {{{#!if +a=='1'
23출력}}} || {{{#!if -a=='1'
24출력}}} || {{{#!if 'a'=='1'
25출력}}} || {{{#!if "a"=='1'
26출력}}} || {{{#!if [a]=='1'
27출력}}} || {{{#!if [a=='1']
28출력}}} || {{{#!if calc(a)=='1'
29출력}}} || {{{#!if calc(+a)=='1'
30출력}}} || {{{#!if calc[a]=='1'
31출력}}} || {{{#!if calc[+a]=='1'
32출력}}} || {{{#!if calc['a']=='1'
33출력}}} || {{{#!if @a@=='1'
34출력}}} ||
35|| =="1" || {{{#!if a=="1"
36출력}}} || {{{#!if +a=="1"
37출력}}} || {{{#!if -a=="1"
38출력}}} || {{{#!if 'a'=="1"
39출력}}} || {{{#!if "a"=="1"
40출력}}} || {{{#!if [a]=="1"
41출력}}} || {{{#!if [a=="1"]
42출력}}} || {{{#!if calc(a)=="1"
43출력}}} || {{{#!if calc(+a)=="1"
44출력}}} || {{{#!if calc[a]=="1"
45출력}}} || {{{#!if calc[+a]=="1"
46출력}}} || {{{#!if calc['a']=="1"
47출력}}} || {{{#!if @a@=="1"
48출력}}} ||
49|| ==\\1 || {{{#!if a==\1
50출력}}} || {{{#!if +a==\1
51출력}}} || {{{#!if -a==\1
52출력}}} || {{{#!if 'a'==\1
53출력}}} || {{{#!if "a"==\1
54출력}}} || {{{#!if [a]==\1
55출력}}} || {{{#!if [a==\1]
56출력}}} || {{{#!if calc(a)==\1
57출력}}} || {{{#!if calc(+a)==\1
58출력}}} || {{{#!if calc[a]==\1
59출력}}} || {{{#!if calc[+a]==\1
60출력}}} || {{{#!if calc['a']==\1
61출력}}} || {{{#!if @a@==\1
62출력}}} ||
r34
63}}}
r4
64
r35
65== 변수 this.a=1 ==
66기준모양 : this.a == 1
r37
67||<table bgcolor=transparent,transparent> 구분 || this.a || +this.a || -this.a || "this.a" || [this.a] || this['a'] || this["a"] || this[+a] || this[a] || +this[a] || +this['a'] || +this["a"] ||
r35
68|| ==1[* 단, -this.a 에는 -this.a==-1로 걸어놓음.] || {{{#!if this.a==1
69출력}}} || {{{#!if +this.a==1
70출력}}} || {{{#!if -this.a==-1
71출력}}} || {{{#!if "this.a"==1
72출력}}} || {{{#!if [this.a]==1
73출력}}} || {{{#!if this['a']==1
74출력}}} || {{{#!if this["a"]==1
75출력}}} || {{{#!if this[+a]==1
76출력}}} || {{{#!if this[a]==1
r37
77출력}}} || {{{#!if +this[a]==1
r35
78출력}}} || {{{#!if +this['a']==1
79출력}}} || {{{#!if +this["a"]==1
r28
80출력}}} ||
r35
81|| =='1' || {{{#!if this.a=='1'
82출력}}} || {{{#!if +this.a=='1'
83출력}}} || {{{#!if -this.a=='1'
84출력}}} || {{{#!if "this.a"=='1'
85출력}}} || {{{#!if [this.a]=='1'
86출력}}} || {{{#!if this['a']=='1'
87출력}}} || {{{#!if this["a"]=='1'
88출력}}} || {{{#!if this[+a]=='1'
89출력}}} || {{{#!if this[a]=='1'
r37
90출력}}} || {{{#!if +this[a]=='1'
r35
91출력}}} || {{{#!if +this['a']=='1'
92출력}}} || {{{#!if +this["a"]=='1'
r28
93출력}}} ||
r35
94|| =="1" || {{{#!if this.a=="1"
95출력}}} || {{{#!if +this.a=="1"
96출력}}} || {{{#!if -this.a=="1"
97출력}}} || {{{#!if "this.a"=="1"
98출력}}} || {{{#!if [this.a]=="1"
99출력}}} || {{{#!if this['a']=="1"
100출력}}} || {{{#!if this["a"]=="1"
101출력}}} || {{{#!if this[+a]=="1"
102출력}}} || {{{#!if this[a]=="1"
r37
103출력}}} || {{{#!if +this[a]=="1"
r35
104출력}}} || {{{#!if +this['a']=="1"
105출력}}} || {{{#!if +this["a"]=="1"
106출력}}} ||
107위의 표는 {{{#!wiki style="display: inline; font-family: monospace;"
108this}}} 함수 안에 {{{#!wiki style="display: inline; font-family: monospace;"
109{{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}}}} 를 포함하여 {{{this}}} 함수 안에 다른 모양을 넣고 테스트를 해보는 표이다.
110{{{#!wiki style="display: inline; font-family: monospace;"
111this\[{{{#orange \+}}}{{{#green 변수명}}}\]}}}과, {{{#!wiki style="display: inline; font-family: monospace;"
112this\[{{{#green 변수명}}}\]}}}도 지원되는지 테스트, this{{{#orange .}}}{{{#green 변수명}}}이 텍스트값으로만 될 수 있는지 테스트.
r4
113
r35
114 * {{{#orange 결론 1 :}}} {{{#!wiki style="display: inline; font-family: monospace;"
115this\[{{{#orange \"}}}{{{#green 변수명}}}{{{#orange \"}}}\]}}}(큰따옴표)은 {{{#!wiki style="display: inline; font-family: monospace;"
116this\[{{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}\]}}}(작은따옴표)와 마찬가지로 텍스트 값으로 출력된다.
117 * {{{#orange 결론 2 :}}} {{{#!wiki style="display: inline; font-family: monospace;"
118this\[{{{#orange \+}}}{{{#green 변수명}}}\]}}}, {{{#!wiki style="display: inline; font-family: monospace;"
119this\[{{{#green 변수명}}}\]}}}은 실수값으로도 텍스트 값으로도 계산하기에는 올바른 입력이 아니다.
120 {{{#!wiki style="display: inline; font-family: monospace;"
121this\[{{{#orange \"}}}{{{#green 변수명}}}{{{#orange \"}}}\]}}}를 숫자 값으로 나오게 하고 싶으면 {{{#!wiki style="display: inline; font-family: monospace;"
122{{{#orangered +}}}this\[{{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}\]}}}이나 {{{#!wiki style="display: inline; font-family: monospace;"
123{{{#orangered +}}}this\[{{{#orange \"}}}{{{#green 변수명}}}{{{#orange \"}}}\]}}} 등 알맞게 입력해야 한다.
124 * {{{#orange 결론 3 :}}} {{{#!wiki style="display: inline; font-family: monospace;"
125this{{{#orange .}}}{{{#green 변수명}}}}}}은 양식만 잘 맞추면 숫자값으로 또는 텍스트값으로 나오게 할 수 있다.
126
127== 변수 a=b, b=1 테스트 ==
128변수 하나를 다른 변수의 포인터(point)로 두고 테스트.
r40
129기준 1. {{{#!wiki style="display: inline; font-family: monospace;"
r66
130\[include(테스트:if문법/include 대상)\]}}}으로 둘 경우
r40
131{{{#!folding [펼치기 · 접기]
r66
132{{{-5 {{{-3 [include(테스트:if문법/include 대상)]}}}}}}}}}
r40
133----
r43
134기준 2. a='b' (텍스트값) 검증 : {{{#!if a=='b'
r42
135{{{#red 검증됨}}} {{{#lightcoral (verified)}}}}}}
r40
136----
r39
137a=b, b=1로 둘 경우 ({{{#!wiki style="display: inline; font-family: monospace;"
r66
138\[include(테스트:if문법/include 대상, a=b, b=1)\]}}})
r35
139{{{#!folding [펼치기 · 접기]
r66
140{{{-5 {{{-3 [include(테스트:if문법/include 대상, a=b, b=1)]}}}}}}}}}+this[a], this[a]가 작동된다.
r40
141----
r38
142 * {{{#orange 결론 1 :}}} {{{#!wiki style="display: inline; font-family: monospace;"
r39
143this\[{{{#green 변수명}}}\]}}}은 문서를 include로 불러올 때 동작된다.
r38
144 포인터(pointer) 변수같이 해당 {{{#!wiki style="display: inline; font-family: monospace;"
r47
145{{{#green 변수명}}}}}}을 {{{#tomato 다른 변수명(텍스트값)}}}으로 정의하는 ({{{#!wiki style="display: inline; font-family: monospace;"
r46
146{{{#green 변수명}}}={{{#tomato 변수명2}}}}}})의 식, 그리고 {{{#green 변수명}}}이 정의한 다른 변수에 값을 정의하는 식이 include 문법(구문)의 괄호 안에 같이 있어야 문서를 include할 때 동작된다. 식을 기입하는 순서는 상관없다.
r41
147 {{{#orange 예 :}}} {{{#!wiki style="display: inline; font-family: monospace;"
r46
148\[include\({{{#skyblue 불러올 문서명}}}, {{{#green 변수명}}}={{{#tomato 변수명2}}}, {{{#tomato 변수명2}}}={{{#teal ''(해당 변수에 정의할 값 입력)''}}}\)\]}}}
r28
149== 변수 c\= ==
r29
150null과 "" 이 어떤 조건에서 되는지 테스트.
151||<table bgcolor=transparent,transparent> 구분 ||<width=20%> {{{#blue c==null}}} ||<width=20%> {{{#orange c==""}}} ||<width=20%> c=={{{#gray ''(space)''}}} ||<width=20%> c="{{{#gray ''(space)''}}}" ||
152|| 출력테스트 || {{{#!if c==null
153출력}}} || {{{#!if c==""
154출력}}} || {{{#!if c==
155출력}}} || {{{#!if c==" "
r28
156출력}}} ||
r8
157
r18
158== this 함수 ==
r29
159===# this \[{{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}\] 관련 테스트 #===
r8
160this['true']=true 테스트
161{{{#!if this['true']==true
162출력 }}}
163----
r32
164this['a'] == null 테스트
165{{{#!if this['a'] == null
166출력}}}
167----
r15
168a=b 테스트 : 아무 변수도 호출하지 않으면 null == null 상태가 된다.
r9
169{{{#!if a==b
r8
170출력}}}
171----
r32
172this['a']=this['b'] 테스트 : 아무 변수도 호출하지 않으면 null == null 상태가 된다.
r8
173{{{#!if this['a']==this['b']
174출력}}}
r9
175----
r22
176a+b=c 테스트 (먼저 숫자로 출력되는 변수들끼리 덧셈식이 올바르게 작동하는지를 검증하기 위한 테스트이다.)
r9
177{{{#!if a+b==c
178출력}}}
179----
180this['a']+this['b']=this['c'] 테스트
181{{{#!if this['a']+this['b']==this['c']
r11
182출력}}}
183----
r15
184+a+b=+c 테스트 : 아무 변수도 호출하지 않으면 nullnull == null 형식이 되는 것으로 추정된다.
r11
185{{{#!if +a+b==+c
186출력}}}
187----
r15
188(+a)+(+b)=+c 테스트 : 숫자값으로 연산하고자 +를 선언했으므로 괄호로 엮어야 한다.
r14
189{{{#!if (+a)+(+b)==+c
190출력}}}
191----
r16
192+this['a']+this['b']=+this['c'] 테스트 : 변수 호출하지 않으면 ++=상태가 된다.
r11
193{{{#!if +this['a']+this['b']==+this['c']
r16
194출력}}}
r18
195----
r16
196(+this['a'])+(+this['b'])=+this['c'] 테스트 : 변수 호출하지 않으면 ++=상태가 된다.
r33
197{{{#!if (+this['a'])+(+this['b'])==+this['c']
r18
198출력}}}
199
r24
200{{{#orange 결론 : }}} {{{#!wiki style="display: inline; font-family: monospace;"
r25
201this\[{{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}\]}}}는 텍스트 값으로 출력된다.
r49
202
203=== this. + 연산자 ===
r52
204this.a.length 테스트 : {{{#!if a!=null
205{{{#!if result_a=this.a.length
206}}}출력 (@result_a@글자)}}}
r50
207
r53
208=== if 변수로 정의하는 틀 출력 테스트 ===
209HP bar 하나 정도를 만들어볼 수 있다. (유효한 변수 이름 : this.percentage)
210{{{#!if this.percentage=
211}}}{{{#!if +percentage>=60
212{{{#!if color="lightgreen"
213}}}}}}{{{#!if (+percentage>=40)&&(+percentage<60)
214{{{#!if color="yellow"
215}}}}}}{{{#!if (+percentage>=20)&&(+percentage<40)
216{{{#!if color="orange"
217}}}}}}{{{#!if (+percentage>=0)&&(+percentage<20)
218{{{#!if color="red"
219}}}}}}{{{#!if range=(percentage!=null)&&((+percentage>=0)&&(+percentage<=100)), !range
220{{{#!if color="gray", percentage=100+0
221}}}}}}
222{{{#!if percentage=percentage.toString()
223}}}{{{#!wiki style="display: inline-table; border: 1px solid gray; width: 25%; height: 1em; background: linear-gradient(to right, @color@ @percentage@%, transparent @percentage@%);"
224{{{#!wiki style="text-align: center; vertical-align: 50%"
225HP {{{#!if range
226@percentage@%}}}{{{#!if !range
227???%}}}}}}}}}
r54
228----
r58
229변수로 문서를 include할 수 있다. 당연하겠지만 이중 include 곧 include한 문서 안에 include하는 문서를 불러오기는 불가능하다. 디버그할 용도로 한 문서에서만 변수로 문서를 include할 수 있다.
230단, 변수값으로 파일 문서 링크는 include로 표시할 수 있다. 파일: 뒤에 이름을 문자열 값으로 저장했던 변수로 불러올 수 있고, "파일:○○○" 식으로 저장한 경우 파일을 불러오지 못한다. {{{파일:}}}은 텍스트값이 아닌 모종의 명령 문구로 변환되는 모양이다.
r54
231{{{#!folding 펼치기, 접기
r58
232{{{-5 {{{#!if recall="더시드위키:대문", recall2="테스트.jpg", recall3="파일:테스트.jpg"
r55
233}}}[Include(@recall@)]
r58
234[[파일:@recall2@|width=100px]] : \[[파일:@,,,,,,변수@|속성]] 출력 시도 예시. 파일이 정상적으로 출력된다.
235[[@recall3@|width=100px]] : \[[@,,,,,,변수@|속성]] 출력 시도 예시. 파일로 이동하는 텍스트 링크가 된다.
236[[@recall3@]] : \[[@,,,,,,변수@]] 로 파일 출력 시도 예시.
r64
237[[파일:@recalltest@|width=100px]] : include 출력 테스트 (유효한 변수 이름 : racalltest)
r59
238}}}}}}
r61
239같은 방법으로 문서에 분류도 달아놓을 수 있다. --[[:분류:테스트]]에 수상한 파일 이름이 분류되어 있다.--
240{{{#!if recall4="테스트", recall5="분류:테스트", recall6="나무마크 문법"
241}}}[[분류:@recall4@|@recall2@]][[@recall5@]][[분류:@recall6@]]