BasicsTutorial/Declaring variables

Last-modified: 2009-11-28 (土) 20:54:38

Declaring variables

変数を宣言すること

So far we have used the different characters on the end of variables to define their type (nothing for integer, # for floats and $ for strings), but that isn’t the neatest way to do things.
これまで、我々はそれの型(タイプ)を定めるために変数の終わりに異なるキャラクタを使った(整数のための何も無い、フロート(実数)のための#と 文字列のための$)、しかし、それはする最もきちんとした方法でない。
You can declare variables to set their type.
あなたは、変数がそれの型(タイプ)をセットすると宣言することができる。
Here is how…
how…は、ここにある

データ型の種類

var1 as integer
var2 as double integer
var3 as float
var4 as double float
var5 as dword
var6 as word
var7 as byte
var8 as boolean
var9 as string

That is 6 more data types than were available to us with the previous method.
それは、前の方法で我々が利用できたより多くの6つのデータ型である。
The advantage of using it?
それを使うことの長所?
There are several… first of all, we have more choice, whenever we used a variable before, say an integer, we may have only used it to store a 1 or a 0.
several…が、まず第一にある、我々が変数を使ったときはいつでも、我々はより多くの選択を整数を言ってもらう、我々は格納にそれを使っただけかもしれない1、あるいは、0。
This requires a tiny bit of information but we are storing it in an integer, which can store numbers over 2 billion!
これは微小な情報を必要とする、しかし、我々はそれを整数に保管している。そして、それは20億以上の数を保存することができる!
What a waste of space!
なんと場所ふさぎ!
We would be able to with this method, use a Boolean variable, which is made to only store the numbers 0 and 1.
我々はこの方法でに有能で、ブールの変数を使う。そして、それは番号0と1を保存させるだけにさられる。
Much less memory used up.
使い果たされる非常により少ないメモリ。
Here are the ranges of each of the data types above…
データ型の各々の範囲は、ここにある

データ型の範囲

Integer = -2,147,483,648 to 2,147,483,648
Double integer = -9,223,372,036,854,775,808 to 9,223,372,036,854,775,808
Float = 3.4E +/- 38 (7 digits)
Double float = 1.7E +/- 308 (15 digits)
Dword = 0 to 4,294,967,295
Word = 0 to 65535
Byte = 0 to 255
Boolean = 0 to 1
String = stores text, unlimited length

Only float and double float can store real numbers (i.e. decimals) and only integer and double integer can store negative numbers.
フロート そして、ダブルフロートは実数(すなわち小数)を保存することができる、そして、整数とダブル整数( double integer)は負数を保存することができる。

Another advantage is that you can easily see the variables in your program if you declare them at the beginning, also in editors like BLUE IDE and Twilight, there are tools which show the variables you declare in a list.
もう一つの利点はあなたが始めで それらを宣言するならば、あなたがあなたのプログラムで変数を簡単に見ることができるということである、青いIDEと薄明かりのようなエディタでも、あなたがリストで宣言することを変数に明らかにするツールがある。
Very handy for neat code.
非常にきちんとしたコードに便利な。
Another small advantage is that you don’t have symbols at the end of your variables, I find it neater that way,
もう一つの小さな利点はあなたが変数名の終わりにシンボルを持たないということである、私はそのようにそれがよりきちんとしているとわかる、

Any way, there is no need for an example here, but I will be using this method from now on (not that there is much more to go), and I advise you do too.
とにかく、例の必要がここにない、しかし、私は今後、この方法(そこのそれは、ずっと多く行くことになっていない)を使用している、そして、私はあなたがまたすると忠告する。

Summary of Commands

命令の概要

· variable AS type - Declares a variable as a certain type.
変数ASタイプ - 特定のタイプとしての変数を宣言する。
See type list above.
上のタイプ・リストを見なさい。

訳者注意:

現在 66bでは、

Double integer, double floatは 働くが精度が悪い。使うな。

よって使える事が出来るのは、以下である。

var1 as integer

var3 as float

var5 as dword

var6 as word

var7 as byte

var8 as boolean

var9 as string

よく使うのは

integer, float#, string$ の3種類だけ。