SlideShare a Scribd company logo
1 of 25
Dynamics NAV 2013
Shan Abeywicrema | Jinasena Infotech | www.jinasenainfotech.com
 Assignment statements assign a value to a
variable. This means that a variable can
represent different values at different times.
 Assignment means to set a variable to a
value.
 When a variable has a value, it keeps that
value until another value is assigned to it, or
until the current set of code ends and the
system no longer keeps track of the variable
 A statement in programming context is a
single complete programming instruction
that is written as code
 Certain function calls, such as the MESSAGE
function, can be a statement on their own.
They are known as function call statements
 [return value :=] <Function Call>
 Example:: MESSAGE function
 The syntax of an assignment statement is
almost as easy as the syntax of the function
call statement. The syntax is as follows
 <variable> := <expression>
 Example :: Integer Number:=10;
 The “colon equals” (:=) is known as the
assignment operator. You use it to assign a
value or an expression that evaluates to a
value to a variable.
 :=
 A single programming statement may span
several code lines; one code line may consist
of multiple statements.
 Therefore, the C/AL compiler must be able to
detect when one statement ends and another
statement begins.
 [ <statement> { ; <statement> } ]
 Example Integer Num:=10;
 Before you can assign a variable to a value,
the type of the value must match the type of
the variable. However, within limits, you can
automatically convert certain types in an
assignment operation.
 You can convert variables of string data types
(code and text) automatically from one to the
other. For example, if Description is a
variable of type Text, and CodeNumber is a
variable of type Code, the following
statement is valid:
 CodeNumber := Description
 Automatic conversion does have limitations. For example, if the value of the Description text
variable has more characters than the length of the CodeNumber variable, an error occurs
when the program runs and executes this statement. This type of error is known as a run-time
error.
 Variables of the numeric data types (integer,
decimal, option, and char) can convert
automatically from one to another
 Demonstration:
Create a Simple Assignment Statement
 Expression
An expression specifies the information to
generate a desired value. Similar to a variable
and a constant, an expression has a type and
a value. expression is evaluated at run time to
determine its value.
Quantity * UnitCost
ASSIGNMENT STATEMENTS AND

More Related Content

What's hot

Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Typesk v
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ LanguageWay2itech
 
Types of Constructor in C++
Types of Constructor in C++Types of Constructor in C++
Types of Constructor in C++Bhavik Vashi
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming LanguageAhmad Idrees
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and AlgorithmDhaval Kaneria
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C ProgrammingKamal Acharya
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programmingprogramming9
 

What's hot (20)

1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
loaders and linkers
 loaders and linkers loaders and linkers
loaders and linkers
 
Introduction to c++ ppt
Introduction to c++ pptIntroduction to c++ ppt
Introduction to c++ ppt
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
 
Data types in C
Data types in CData types in C
Data types in C
 
Types of Constructor in C++
Types of Constructor in C++Types of Constructor in C++
Types of Constructor in C++
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
C language ppt
C language pptC language ppt
C language ppt
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Strings in C
Strings in CStrings in C
Strings in C
 

Similar to ASSIGNMENT STATEMENTS AND

C++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSC++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSAami Kakakhel
 
C presentation! BATRA COMPUTER CENTRE
C presentation! BATRA  COMPUTER  CENTRE C presentation! BATRA  COMPUTER  CENTRE
C presentation! BATRA COMPUTER CENTRE jatin batra
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programmingNgeam Soly
 
Switch Case Statement
Switch Case StatementSwitch Case Statement
Switch Case StatementDucat India
 
Variables and calculations_chpt_4
Variables and calculations_chpt_4Variables and calculations_chpt_4
Variables and calculations_chpt_4cmontanez
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfAbrehamKassa
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answerVasuki Ramasamy
 
Embedded C The IoT Academy
Embedded C The IoT AcademyEmbedded C The IoT Academy
Embedded C The IoT AcademyThe IOT Academy
 
CS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdfCS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdfIda Lumintu
 
Handout # 4 functions + scopes
Handout # 4   functions + scopes Handout # 4   functions + scopes
Handout # 4 functions + scopes NUST Stuff
 
Javascript sivasoft
Javascript sivasoftJavascript sivasoft
Javascript sivasoftch samaram
 
The future of DSLs - functions and formal methods
The future of DSLs - functions and formal methodsThe future of DSLs - functions and formal methods
The future of DSLs - functions and formal methodsMarkus Voelter
 
Data Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# ProgrammingData Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# ProgrammingSherwin Banaag Sapin
 
Dot net programming concept
Dot net  programming conceptDot net  programming concept
Dot net programming conceptsandeshjadhav28
 

Similar to ASSIGNMENT STATEMENTS AND (20)

C++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSC++ PROGRAMMING BASICS
C++ PROGRAMMING BASICS
 
Opps concept
Opps conceptOpps concept
Opps concept
 
C presentation! BATRA COMPUTER CENTRE
C presentation! BATRA  COMPUTER  CENTRE C presentation! BATRA  COMPUTER  CENTRE
C presentation! BATRA COMPUTER CENTRE
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programming
 
Switch Case Statement
Switch Case StatementSwitch Case Statement
Switch Case Statement
 
Variables and calculations_chpt_4
Variables and calculations_chpt_4Variables and calculations_chpt_4
Variables and calculations_chpt_4
 
Intro to Scala
 Intro to Scala Intro to Scala
Intro to Scala
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdf
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
 
Shanks
ShanksShanks
Shanks
 
Embedded C The IoT Academy
Embedded C The IoT AcademyEmbedded C The IoT Academy
Embedded C The IoT Academy
 
Pc module1
Pc module1Pc module1
Pc module1
 
CS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdfCS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdf
 
Handout # 4 functions + scopes
Handout # 4   functions + scopes Handout # 4   functions + scopes
Handout # 4 functions + scopes
 
Javascript sivasoft
Javascript sivasoftJavascript sivasoft
Javascript sivasoft
 
The future of DSLs - functions and formal methods
The future of DSLs - functions and formal methodsThe future of DSLs - functions and formal methods
The future of DSLs - functions and formal methods
 
Data Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# ProgrammingData Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# Programming
 
Dot net programming concept
Dot net  programming conceptDot net  programming concept
Dot net programming concept
 
MODULE_2_Operators.pptx
MODULE_2_Operators.pptxMODULE_2_Operators.pptx
MODULE_2_Operators.pptx
 
Web programming
Web programmingWeb programming
Web programming
 

ASSIGNMENT STATEMENTS AND

  • 1. Dynamics NAV 2013 Shan Abeywicrema | Jinasena Infotech | www.jinasenainfotech.com
  • 2.  Assignment statements assign a value to a variable. This means that a variable can represent different values at different times.
  • 3.  Assignment means to set a variable to a value.  When a variable has a value, it keeps that value until another value is assigned to it, or until the current set of code ends and the system no longer keeps track of the variable
  • 4.  A statement in programming context is a single complete programming instruction that is written as code
  • 5.  Certain function calls, such as the MESSAGE function, can be a statement on their own. They are known as function call statements  [return value :=] <Function Call>  Example:: MESSAGE function
  • 6.  The syntax of an assignment statement is almost as easy as the syntax of the function call statement. The syntax is as follows  <variable> := <expression>  Example :: Integer Number:=10;
  • 7.  The “colon equals” (:=) is known as the assignment operator. You use it to assign a value or an expression that evaluates to a value to a variable.  :=
  • 8.  A single programming statement may span several code lines; one code line may consist of multiple statements.  Therefore, the C/AL compiler must be able to detect when one statement ends and another statement begins.  [ <statement> { ; <statement> } ]  Example Integer Num:=10;
  • 9.  Before you can assign a variable to a value, the type of the value must match the type of the variable. However, within limits, you can automatically convert certain types in an assignment operation.
  • 10.  You can convert variables of string data types (code and text) automatically from one to the other. For example, if Description is a variable of type Text, and CodeNumber is a variable of type Code, the following statement is valid:  CodeNumber := Description  Automatic conversion does have limitations. For example, if the value of the Description text variable has more characters than the length of the CodeNumber variable, an error occurs when the program runs and executes this statement. This type of error is known as a run-time error.
  • 11.  Variables of the numeric data types (integer, decimal, option, and char) can convert automatically from one to another
  • 12.  Demonstration: Create a Simple Assignment Statement
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.  Expression An expression specifies the information to generate a desired value. Similar to a variable and a constant, an expression has a type and a value. expression is evaluated at run time to determine its value. Quantity * UnitCost