더시드위키
최근 변경
최근 토론
임의 문서
도구
최근 변경
테스트:if문법/include 대상
(r55 RAW)
[[분류:테스트]][[분류:나무마크 문법]] [[../|상위 문서]] [[../include 결과|결과 보기]] == 변수 a=1 == * 기본형식 : a==1 {{{#!wiki style="word-break: keep-all;" ||<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@= || || ==1[* 단, -a= 열에는 if 조건문을 -a==-1 으로 걸어놓음.] || {{{#!if a==1 출력}}} || {{{#!if +a==1 출력}}} || {{{#!if -a==-1 출력}}} || {{{#!if 'a'==1 출력}}} || {{{#!if "a"==1 출력}}} || {{{#!if [a]==1 출력}}} || {{{#!if [a==1] 출력}}} || {{{#!if calc(a)==1 출력}}} || {{{#!if calc(+a)==1 출력}}} || {{{#!if calc[a]==1 출력}}} || {{{#!if calc[+a]==1 출력}}} || {{{#!if calc['a']==1 출력}}} || {{{#!if @a@==1 출력}}} || || =='1' || {{{#!if a=='1' 출력}}} || {{{#!if +a=='1' 출력}}} || {{{#!if -a=='1' 출력}}} || {{{#!if 'a'=='1' 출력}}} || {{{#!if "a"=='1' 출력}}} || {{{#!if [a]=='1' 출력}}} || {{{#!if [a=='1'] 출력}}} || {{{#!if calc(a)=='1' 출력}}} || {{{#!if calc(+a)=='1' 출력}}} || {{{#!if calc[a]=='1' 출력}}} || {{{#!if calc[+a]=='1' 출력}}} || {{{#!if calc['a']=='1' 출력}}} || {{{#!if @a@=='1' 출력}}} || || =="1" || {{{#!if a=="1" 출력}}} || {{{#!if +a=="1" 출력}}} || {{{#!if -a=="1" 출력}}} || {{{#!if 'a'=="1" 출력}}} || {{{#!if "a"=="1" 출력}}} || {{{#!if [a]=="1" 출력}}} || {{{#!if [a=="1"] 출력}}} || {{{#!if calc(a)=="1" 출력}}} || {{{#!if calc(+a)=="1" 출력}}} || {{{#!if calc[a]=="1" 출력}}} || {{{#!if calc[+a]=="1" 출력}}} || {{{#!if calc['a']=="1" 출력}}} || {{{#!if @a@=="1" 출력}}} || || ==\\1 || {{{#!if a==\1 출력}}} || {{{#!if +a==\1 출력}}} || {{{#!if -a==\1 출력}}} || {{{#!if 'a'==\1 출력}}} || {{{#!if "a"==\1 출력}}} || {{{#!if [a]==\1 출력}}} || {{{#!if [a==\1] 출력}}} || {{{#!if calc(a)==\1 출력}}} || {{{#!if calc(+a)==\1 출력}}} || {{{#!if calc[a]==\1 출력}}} || {{{#!if calc[+a]==\1 출력}}} || {{{#!if calc['a']==\1 출력}}} || {{{#!if @a@==\1 출력}}} || }}} == 변수 this.a=1 == 기준모양 : this.a == 1 ||<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"] || || ==1[* 단, -this.a 에는 -this.a==-1로 걸어놓음.] || {{{#!if this.a==1 출력}}} || {{{#!if +this.a==1 출력}}} || {{{#!if -this.a==-1 출력}}} || {{{#!if "this.a"==1 출력}}} || {{{#!if [this.a]==1 출력}}} || {{{#!if this['a']==1 출력}}} || {{{#!if this["a"]==1 출력}}} || {{{#!if this[+a]==1 출력}}} || {{{#!if this[a]==1 출력}}} || {{{#!if +this[a]==1 출력}}} || {{{#!if +this['a']==1 출력}}} || {{{#!if +this["a"]==1 출력}}} || || =='1' || {{{#!if this.a=='1' 출력}}} || {{{#!if +this.a=='1' 출력}}} || {{{#!if -this.a=='1' 출력}}} || {{{#!if "this.a"=='1' 출력}}} || {{{#!if [this.a]=='1' 출력}}} || {{{#!if this['a']=='1' 출력}}} || {{{#!if this["a"]=='1' 출력}}} || {{{#!if this[+a]=='1' 출력}}} || {{{#!if this[a]=='1' 출력}}} || {{{#!if +this[a]=='1' 출력}}} || {{{#!if +this['a']=='1' 출력}}} || {{{#!if +this["a"]=='1' 출력}}} || || =="1" || {{{#!if this.a=="1" 출력}}} || {{{#!if +this.a=="1" 출력}}} || {{{#!if -this.a=="1" 출력}}} || {{{#!if "this.a"=="1" 출력}}} || {{{#!if [this.a]=="1" 출력}}} || {{{#!if this['a']=="1" 출력}}} || {{{#!if this["a"]=="1" 출력}}} || {{{#!if this[+a]=="1" 출력}}} || {{{#!if this[a]=="1" 출력}}} || {{{#!if +this[a]=="1" 출력}}} || {{{#!if +this['a']=="1" 출력}}} || {{{#!if +this["a"]=="1" 출력}}} || 위의 표는 {{{#!wiki style="display: inline; font-family: monospace;" this}}} 함수 안에 {{{#!wiki style="display: inline; font-family: monospace;" {{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}}}} 를 포함하여 {{{this}}} 함수 안에 다른 모양을 넣고 테스트를 해보는 표이다. {{{#!wiki style="display: inline; font-family: monospace;" this\[{{{#orange \+}}}{{{#green 변수명}}}\]}}}과, {{{#!wiki style="display: inline; font-family: monospace;" this\[{{{#green 변수명}}}\]}}}도 지원되는지 테스트, this{{{#orange .}}}{{{#green 변수명}}}이 텍스트값으로만 될 수 있는지 테스트. * {{{#orange 결론 1 :}}} {{{#!wiki style="display: inline; font-family: monospace;" this\[{{{#orange \"}}}{{{#green 변수명}}}{{{#orange \"}}}\]}}}(큰따옴표)은 {{{#!wiki style="display: inline; font-family: monospace;" this\[{{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}\]}}}(작은따옴표)와 마찬가지로 텍스트 값으로 출력된다. * {{{#orange 결론 2 :}}} {{{#!wiki style="display: inline; font-family: monospace;" this\[{{{#orange \+}}}{{{#green 변수명}}}\]}}}, {{{#!wiki style="display: inline; font-family: monospace;" this\[{{{#green 변수명}}}\]}}}은 실수값으로도 텍스트 값으로도 계산하기에는 올바른 입력이 아니다. {{{#!wiki style="display: inline; font-family: monospace;" this\[{{{#orange \"}}}{{{#green 변수명}}}{{{#orange \"}}}\]}}}를 숫자 값으로 나오게 하고 싶으면 {{{#!wiki style="display: inline; font-family: monospace;" {{{#orangered +}}}this\[{{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}\]}}}이나 {{{#!wiki style="display: inline; font-family: monospace;" {{{#orangered +}}}this\[{{{#orange \"}}}{{{#green 변수명}}}{{{#orange \"}}}\]}}} 등 알맞게 입력해야 한다. * {{{#orange 결론 3 :}}} {{{#!wiki style="display: inline; font-family: monospace;" this{{{#orange .}}}{{{#green 변수명}}}}}}은 양식만 잘 맞추면 숫자값으로 또는 텍스트값으로 나오게 할 수 있다. == 변수 a=b, b=1 테스트 == 변수 하나를 다른 변수의 포인터(point)로 두고 테스트. 기준 1. {{{#!wiki style="display: inline; font-family: monospace;" \[include(테스트:If문법/include 대상)\]}}}으로 둘 경우 {{{#!folding [펼치기 · 접기] {{{-5 {{{-3 [include(테스트:If문법/include 대상)]}}}}}}}}} ---- 기준 2. a='b' (텍스트값) 검증 : {{{#!if a=='b' {{{#red 검증됨}}} {{{#lightcoral (verified)}}}}}} ---- a=b, b=1로 둘 경우 ({{{#!wiki style="display: inline; font-family: monospace;" \[include(테스트:If문법/include 대상, a=b, b=1)\]}}}) {{{#!folding [펼치기 · 접기] {{{-5 {{{-3 [include(테스트:If문법/include 대상, a=b, b=1)]}}}}}}}}}+this[a], this[a]가 작동된다. ---- * {{{#orange 결론 1 :}}} {{{#!wiki style="display: inline; font-family: monospace;" this\[{{{#green 변수명}}}\]}}}은 문서를 include로 불러올 때 동작된다. 포인터(pointer) 변수같이 해당 {{{#!wiki style="display: inline; font-family: monospace;" {{{#green 변수명}}}}}}을 {{{#tomato 다른 변수명(텍스트값)}}}으로 정의하는 ({{{#!wiki style="display: inline; font-family: monospace;" {{{#green 변수명}}}={{{#tomato 변수명2}}}}}})의 식, 그리고 {{{#green 변수명}}}이 정의한 다른 변수에 값을 정의하는 식이 include 문법(구문)의 괄호 안에 같이 있어야 문서를 include할 때 동작된다. 식을 기입하는 순서는 상관없다. {{{#orange 예 :}}} {{{#!wiki style="display: inline; font-family: monospace;" \[include\({{{#skyblue 불러올 문서명}}}, {{{#green 변수명}}}={{{#tomato 변수명2}}}, {{{#tomato 변수명2}}}={{{#teal ''(해당 변수에 정의할 값 입력)''}}}\)\]}}} == 변수 c\= == null과 "" 이 어떤 조건에서 되는지 테스트. ||<table bgcolor=transparent,transparent> 구분 ||<width=20%> {{{#blue c==null}}} ||<width=20%> {{{#orange c==""}}} ||<width=20%> c=={{{#gray ''(space)''}}} ||<width=20%> c="{{{#gray ''(space)''}}}" || || 출력테스트 || {{{#!if c==null 출력}}} || {{{#!if c=="" 출력}}} || {{{#!if c== 출력}}} || {{{#!if c==" " 출력}}} || == this 함수 == ===# this \[{{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}\] 관련 테스트 #=== this['true']=true 테스트 {{{#!if this['true']==true 출력 }}} ---- this['a'] == null 테스트 {{{#!if this['a'] == null 출력}}} ---- a=b 테스트 : 아무 변수도 호출하지 않으면 null == null 상태가 된다. {{{#!if a==b 출력}}} ---- this['a']=this['b'] 테스트 : 아무 변수도 호출하지 않으면 null == null 상태가 된다. {{{#!if this['a']==this['b'] 출력}}} ---- a+b=c 테스트 (먼저 숫자로 출력되는 변수들끼리 덧셈식이 올바르게 작동하는지를 검증하기 위한 테스트이다.) {{{#!if a+b==c 출력}}} ---- this['a']+this['b']=this['c'] 테스트 {{{#!if this['a']+this['b']==this['c'] 출력}}} ---- +a+b=+c 테스트 : 아무 변수도 호출하지 않으면 nullnull == null 형식이 되는 것으로 추정된다. {{{#!if +a+b==+c 출력}}} ---- (+a)+(+b)=+c 테스트 : 숫자값으로 연산하고자 +를 선언했으므로 괄호로 엮어야 한다. {{{#!if (+a)+(+b)==+c 출력}}} ---- +this['a']+this['b']=+this['c'] 테스트 : 변수 호출하지 않으면 ++=상태가 된다. {{{#!if +this['a']+this['b']==+this['c'] 출력}}} ---- (+this['a'])+(+this['b'])=+this['c'] 테스트 : 변수 호출하지 않으면 ++=상태가 된다. {{{#!if (+this['a'])+(+this['b'])==+this['c'] 출력}}} {{{#orange 결론 : }}} {{{#!wiki style="display: inline; font-family: monospace;" this\[{{{#orange \'}}}{{{#green 변수명}}}{{{#orange \'}}}\]}}}는 텍스트 값으로 출력된다. === this. + 연산자 === this.a.length 테스트 : {{{#!if a!=null {{{#!if result_a=this.a.length }}}출력 (@result_a@글자)}}} === if 변수로 정의하는 틀 출력 테스트 === HP bar 하나 정도를 만들어볼 수 있다. (유효한 변수 이름 : this.percentage) {{{#!if this.percentage= }}}{{{#!if +percentage>=60 {{{#!if color="lightgreen" }}}}}}{{{#!if (+percentage>=40)&&(+percentage<60) {{{#!if color="yellow" }}}}}}{{{#!if (+percentage>=20)&&(+percentage<40) {{{#!if color="orange" }}}}}}{{{#!if (+percentage>=0)&&(+percentage<20) {{{#!if color="red" }}}}}}{{{#!if range=(percentage!=null)&&((+percentage>=0)&&(+percentage<=100)), !range {{{#!if color="gray", percentage=100+0 }}}}}} {{{#!if percentage=percentage.toString() }}}{{{#!wiki style="display: inline-table; border: 1px solid gray; width: 25%; height: 1em; background: linear-gradient(to right, @color@ @percentage@%, transparent @percentage@%);" {{{#!wiki style="text-align: center; vertical-align: 50%" HP {{{#!if range @percentage@%}}}{{{#!if !range ???%}}}}}}}}} ---- 변수로 문서를 include할 수 있다. 당연하겠지만 이중 include는 불가능하다. 디버그할 용도로 문서 안에서만 가능하다. {{{#!folding 펼치기, 접기 {{{-5 {{{#!if recall="더시드위키:대문", recall2="파일:테스트.jpg" }}}[Include(@recall@)] [[@recall2@|width=100%]]}}}}}}
Liberty
|
the seed