- Number - Int / Float - ตัวเลข
- Boolean - ค่าความเป็นจริงหรือเท็จ
- Character - ตัวอักษร
- String / Text
0, 1, 2, 3, 10, 100
0.25, 0.8, 3.5
True, False จริง กับ เท็จ
symbol >, <, == (= =)
- < น้อยกว่า
-
มากกว่า
- <= น้อยกว่า หรือ เท่ากับ
-
= มากกว่า หรือ เท่ากับ
=
=> assign (ใส่ค่าเข้าไปในตัวแปร)
==
=> check equal (เช็คว่าเท่ากันไหม)
- มี 1 ตัวอักษรเสมอ
a, ก, "1", '1'
- คือ หลายๆ character รวมกัน
Character(s)
'abc', 'กขค'
String | Boolean | Number | Character
- FALSE - Boolean
- 'TRUE' - String
- 5 - Number
- 0 - Number
- '7' - Character
- '' - String (*)
null
1 + 1 = 2 2 - 1 = 1 1 - 2 = -1
-Infinity => Infinity
-100, -10, -3, -2, -1, 0, 1, 2, 3, 5, 10, 100
ชื่อตัวแปร = ค่าของตัวแปร
name = "kamontat" <- ชื่ออะไร age = 200 working = false (boolean)
String/Character | Number
- Number + Number = Number
- String + String = String
- Character + Character = String
- String + Number = String
1 + 1 = 2 3 + 4 = 7
'abc' + 'def' = 'abcdef' 'กก' + 'ขข' = 'กกขข'
'abc' + 12 = 'abc12'
Character + Character = String (เสมอ) 'a' + 'b' = 'ab' (String)
เวลาโค๊ดรัน จะรันจากบรรทัดที่ 1 เสมอ