0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ifによる分岐かSelectか

Posted at

2つならifの方がよい


If a = 1 Then
1111111
Else
If a = 2 Then
2222222
Else
If a = 3 Then
・・・

数個にわたって場合分けを行うときに使う。


Select Case 場合分け用の変数など
 Case 範囲1
  範囲1の場合に実行させたい命令ブロック
 Case 範囲2

 FOR~NEXT文 :指定回数分,繰り返し計算を実行

   FOR ループ変数 =初期値 TO 最終値 [STEP 増分値]

    繰り返される             →ループ変数を初期値から増分値ずつ増し,
    ステートメントブロック          最終値になるまで繰り返す。

   NEXT ループ変数
  範囲2の場合に実行させたい命令ブロック
 Case Else
  全て(範囲1,2)に当てはまらなかった場合の命令ブロック
End Select

FOR i=1 TO 100
            FOR j=1 TO 10
                FOR k=1 TO 50
          
                NEXT k
                FOR m=1 TO 20

                NEXT m
            NEXT j
         NEXT i

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?