1 / 9

変数とは

変数とは. 数値や文字列を一時的に保管する入れ物 使用するときは宣言する 変数名は自由につけることができる いくつかのデータの型がある. 変数の宣言例 ・ローカル変数,モジュール変数の場合 Dim 変数名 As データ型 ・パブリック変数の場合 Public 変数名 As データ型. 代表的なデータの型. 変数のデータ型の例 Dim 変数名 As データ型 Public 変数名 As データ型. Integer   整数の場合 Single   単精度浮動小数点数型の場合 Double   倍単精度浮動小数点数型の場合

chance
Download Presentation

変数とは

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 変数とは • 数値や文字列を一時的に保管する入れ物 • 使用するときは宣言する • 変数名は自由につけることができる • いくつかのデータの型がある

  2. 変数の宣言例 ・ローカル変数,モジュール変数の場合 Dim 変数名 As データ型 ・パブリック変数の場合 Public 変数名 As データ型

  3. 代表的なデータの型

  4. 変数のデータ型の例 Dim 変数名 Asデータ型 Public 変数名 Asデータ型 Integer  整数の場合 Single  単精度浮動小数点数型の場合 Double  倍単精度浮動小数点数型の場合 String  文字列型の場合

  5. モジュール 2 モジュール 1 Public a Dim b Public e Dim f プロシージャ1 プロシージャ3 Dim c Dim g プロシージャ2 プロシージャ4 Dim d Dim h 変数の適用範囲 ローカル変数c,d,g,h モジュール変数b,f パブリック変数a,e

  6. 変数の種類 • ローカル変数プロシージャ内のみ有効Dimで宣言 • モジュール変数モジュール内のみ有効Dimで宣言 • パブリック変数どこでも有効Publicで宣言

  7. モジュール 2 モジュール 1 Public a Dim b Public e Dim f プロシージャ1 プロシージャ3 Dim c Dim g プロシージャ3 プロシージャ4 Dim d Dim h 変数の適用範囲 ローカル変数c,d,g,h モジュール変数b,f パブリック変数a,e

  8. 整数型 整数型 以外の型 バリアント型 バリアント型 以外の型 整数に変換 バリアント型に変換 データ型変換関数の例 a = CInt ( b) c = CVar ( d )

  9. 代表的なデータの型

More Related