Skip to main content

A Caché Basic Routine

Let's start by taking a look at a simple, yet nontrivial Caché Basic routine. Click here to see it. It computes the area and hypotenuse of a right triangle, given the lengths of the two sides. Let's run it:

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>

As you can see from the code, the routine contains subroutines and functions, both public and private, and familiar commands and functions: Println, Input, Return, Exit Sub/Do, Select Case, Do/Loop, If/Else, Left(), Chr(), Round(), and Sqr().

Next, we'll get started using Caché Basic.

FeedbackOpens in a new tab