BasicsTutorial/Select-Case statements

Last-modified: 2008-03-07 (金) 13:14:12

Select-Case statements

セレクトケース命令文

Select-Case statements are basically different forms of IF statements.
Select-Case命令文が基本的に異なる形でのIF文です。
This is how they are formed…
これは、それがformed…である方法である

select variable
           case val1
                       <do stuff>
           endcase
           case val2
                       <do stuff>
           endcase
           case default
                       <do stuff>
           endcase
endselect

Basically you put the variable that you want to check after SELECT, then you put ENDSELECT to close the statement.
基本的に、あなたはあなたが SELECTの後でチェックすることを望む変数を置いた、そして、あなたは命令文を終えるために ENDSELECTを置いた。
Then inbetween you put case statements using CASE and ENDCASE.
それから間に、あなたは CASEと ENDCASEを使っているCASE命令文を置いた。
After CASE you put a value that you want to check the variable for.
CASEの後、あなたはあなたが変数をチェックしたい値を置いた。
If the variable has this value then it will do the stuff in the case statement.
変数がこの値を持つならば、それはケース命令文においてものをする。
Otherwise it will move on.
さもなければ、それは進む。
You can put as many CASE statements as you want.
あなたは、あなたが望むのと同じくらい多くのCASE命令文を置くことができる。
At the end you can put an optional CASE DEFAULT statement, whatever is inside the statement will be executed if none of the other CASEs are found to be true.
終わりには、あなたはオプションのCASE DEFAULT命令文を置くことができる、他のCASEのどれも真実であるとわからないならば、命令文内部にあるものは何でも実行される。
Basically like the ELSE command in if statements.
基本的に、if文のELSE命令に似ている。
Here is an example…
example…は、ここにある

start:
input "Choose a number between 1 to 4: ",var
select var
       case 1
           print "Oooh arrr!"
     endcase
     case 2
           print "Top o' the mornin' to ya!"
     endcase
     case 3
           print "Blimey guvner!"
     endcase
     case 4
           print "G'day mate!"
     endcase
     case default
           print "Can ye nay read laddy?  Says 1 to 4!!!"
     endcase
endselect
goto start

I’m sure you get it by now J.
私は、あなたが今ごろはそれを得ると確信する(。
No point in going over something too much.
それほど何かの上に行く意味でない。

Summary of Commands

命令の概要

· SELECT variable - Starts a select statement with the variable specified to be checked.
SELECT変数-SELECT命令文をチェックされることを示されている変数で始める。

· ENDSELECT - Ends a select statement
ENDSELECT- セレクト命令文を終える

· CASE value - Checks if the variable selected contains this value.
CASE 値-選ばれる変数がこの値を含むかどうか調べる。
If it does, it executes the code between it and the ENDCASE command.
それがそうするならば、それはそれとENDCASE命令の間でコードを実行する。

· ENDCASE - Closes a case statement.
ENDCASE-ケース命令文を終える。

· CASE DEFAULT - One allowed per select statement.
CASE DEFAULT – ひとつが選ばれた命令文につき認めた。
If none of the CASE statement were true it executes the code between this and the ENDCASE statement.
ケース命令文の何も真でないならば、それはこれとENDCASE命令文の間でコードを実行する。