Caché Basic ルーチン
ここでは、簡単ですが重要な Caché Basic ルーチンについて学習します。ここをクリックすると、そのルーチンが表示されます。このルーチンでは、直角三角形の両辺の長さを元に面積と斜辺を計算します。では、見てみましょう。
SAMPLES>do Run^BASRightTriangle()
Compute the area and hypotenuse of a right triangle
given the lengths of its two sides.
First, choose a unit of measurement.
(i)nches, (f)eet, (m)iles, (c)entimeters, m(e)ters, (k)ilometers: i
Length of side 1: 3 Accepted.
Length of side 2: 4 Accepted.
The area of this triangle is 6 square inches.
The hypotenuse is 5 inches.
SAMPLES>
コードからわかるように、ルーチンには、パブリックとプライベートの両方のサブルーチンと関数があり、また、一般的なコマンドと関数 Println、Input、Return、Exit Sub/Do、Select Case、Do/Loop、If/Else、Left()、Chr()、Round()、Sqr() が含まれています。
次に、Caché Basic を使用してみましょう。