User Tools

Site Tools


Sidebar


Introduction


Basic Tutorials


Advance Tutorials


Useful Techniques


Examples

  • Simple Pipe Weight Calculator
  • Unit Convertor

Sidebar

tutorial:variableandconstant

This is an old revision of the document!


Variables/Constant

Variables คือ ตัวแปรที่ใช้เก็บข้อมูล โดยข้อมูลต่างๆจะเก็บไว้ในหน่วยความจำ ขนาดของหน่วยความจำขึ้นอยู่กับชนิดของตัวแปร ตัวแปรชนิดนี้สามารถแก้ใขค่าได้ตลอดเวลา Constants คือ ตัวแปรเช่นกัน แต่จะไม่มีการเปลี่ยนแปลงค่าใดๆในระหว่างที่โปรแกรมถูกเรียกใช้งาน

Variable Type การประกาศ (Declaration)
ตัวแปรคงที่ (Constant)
const max = 10;
      min = 1;
      pi = 3.1415; 
ตัวแปรทั่วไป (Variable)
var a:byte;
    b:integer;
    c:real;
    d:double;
    e:boolean;
    f:char;
    g:string;
    
begin
    // Assign value:
    a:=1;
    b:=2020;
    c:=2.456;
    d:=567.3245;
    e:= true; // or false
    f:='B';
    g:='Hello Everybody';
end.


tutorial/variableandconstant.1545789342.txt.gz · Last modified: 2018/12/26 08:55 by admin