變數

c++

// 變數要宣告

int a; // 整數

long a; // 長整數

unsigned int a;  // 無號整數

unsigned long a; // 無號長整數

float a; // 單精準浮點

double a; // 雙精準浮點

char c; // 字元

char a[30]; //字串 (最後一個字必須為 0)

perl

perl 的變數要加上符號。

perl 的變數沒有那麼嚴格。

perl 可以不用宣告變數,若要宣告,可以用 my 或 local。

my 是區域變數, local 也是區域, 但範圍內的副程式也可以取得變數數值。

如果 perl 要強迫宣告,在一開始要加上 use strict;

my $a = 123; # 數字

my $a = "this is a string."; # 字串

my @a = ("aa", 123, "bb");  # 陣列,

$a[100] = "abc"; #可以直接指定任一數值的索引

my %hash = ("aa" => "first", "bb" => "second", "cc" => "第三筆資料"); # 雜湊 (hash)

$hash{"aa"} = "new first"; # 雜湊某一筆的內容

javascript

 

php

 

python

 

java

重要度:
文章分類:

發表新回應

Filtered HTML

  • 自動將網址與電子郵件地址轉變為連結。
  • HTML markup is restricted and corrected using the htmLawed filter/purifier.
  • 自動斷行和分段。

Plain text

  • 不允許使用 HTML 標籤。
  • 自動將網址與電子郵件地址轉變為連結。
  • 自動斷行和分段。
借我放一下廣告