Free Pascal Program Tutorial 3 - Variables and Data Types - Lazarus

preview_player
Показать описание


The common data types that should be known are:

Integer  - It is a whole number. Its range varies by system. For example in Windows XP the integer's range is -2147483648 to 2147483647.

Real  - Real is a floating point number. Its range varies by system. For example in Windows XP, real's range 5.0E - 324 to 1.7E 308.

String - String is text.

Char - Char is a single text character by the computer. For example: a, B, &, @, l, and 4.

Boolean - A boolean variable is either TRUE or FALSE

To create a variable, place the word var between the uses section and begin (program section). The syntax for variable include:

name_of_variable:data_type;

Example:

var
  name:string;
  num1:integer;
  num2:integer;
  total:real;
Рекомендации по теме
Комментарии
Автор

One tip for you starters: If you have multiple variables of the same type, you dont have to write them all 1 by 1 like a:integer; b:integer; c:integer; etc. You can put them all together like: a, b, c:integer;

milanmilovanovic
Автор

I'm so happy I found these tutorials :)
Thanks for your efforts!

replacementtechnique
Автор

Thank you for the help ! Exams that will decide my life is coming up. Gonna watch all these vids like 3 times a week. lol

JohnathanCrisco
Автор

next tips for starter after learn a lot
1. dont use var like a, b, c. use more detail name. it help you in future coding
2. sometime combine var on 1 line is good. But sometime it help you if you separated on different line
3. read more about the type and when to use it. sometime using bigger type or different type help a lot
4. remember to put comment about how variable use if you have time

MrGbison
Автор

Thanks for teaching. I am your new follower!

aaronargottelopez
Автор

thank god you re uploaded them, cos the ones that I bookmarked are gone :S

Creamagination
Автор

Tip: if you're on linux and wondering why no terminal appears, press Ctrl+Alt+O to open Lazarus's console.

leonidas
Автор

Help! Please
I made a program with dev pascal in my phone, but when i pastel a code to my computer. the program can't be compiled .

vxbx
Автор

thanks bro ♥ ♥♥♥♥♥ that was so amazing ♥

TidelxD
Автор

What is the app the symbol camera in the taskbar?

apsarakarunanayaka
Автор

How would you do this is pascal?

if Num<=100 &&Num>=85 then
begin
writeln('hey');
end;

Spirittism
Автор

I have a question:
> IF VarA = [ 2 Strings ] THEN <
Can you insert 2 Strings In the above?
If u can, please tell me how?

rnkacc
Автор

I tried accessing the length byte of a string, for instance...
Var
stg:string;
begin
stg := "Harold";
writeln('Length is ', stg[0]);
write('First character in name is ', stg[(stg[0]-stg[0])+1]); <-- not happening!

SOLUTION IS
write('First character in name is ',
end.

haroldmcbroom
Автор

CHAR is short for character hence it should be pronounced as CHAR (like char broiled steak).

bjbell
Автор

Just a minor complaint, but it's something that always bugs me: char is NOT pronounced "char", as in charred meat, it's pronounced "character", as in a number or letter of the alphabet... You just say the word character- yes, the whole word. It's was named "char" as a syntactic shortcut, but not intended to be read as though it was short for Charlie.

siliconpenguin
Автор

i don't really get what is this about :/

roget
visit shbcf.ru