Dani Vainstein1 VBScript Session 3. Dani Vainstein2 What We learn Last seasson? How to declare arrays. Working with one dimensional a multi- dimensional.

Slides:



Advertisements
Similar presentations
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Advertisements

Lecture Set 4 Data Types and Variables Part B – Variables, Constants, Expressions Conversion Rules Options Strict, Option Explicit Scope of Definition.
Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
Class 7.
Introduction to Computers and Programming Lecture 4: Mathematical Operators New York University.
Basic Elements of Programming A VB program is built from statements, statements from expressions, expressions from operators and operands, and operands.
10 November JavaScript. Presentation Hints What do YOU think makes a good presentation Some of my suggestions Don’t write full sentences on slides Talk,
Chapter 2: Java Fundamentals Operators. Introduction to OOP Dr. S. GANNOUNI & Dr. A. TOUIR Page 2 Content Group of Operators Arithmetic Operators Assignment.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
Slide 1 Variables, Constants and Data Types. Slide 2 Variables v Three components define a variable: –Name (memory location) –Type –Information (value)
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
Primitive Types CSE 115 Spring 2006 April 3 &
JavaScript, Fourth Edition
ASP.NET Programming with C# and SQL Server First Edition
JavaScript, Third Edition
Introduction to C Programming
1 Expressions, Operators Expressions Operators and Precedence Reading for this class: L&L, 2.4.
Compunet Corporation1 Programming with Visual Basic.NET Arithmetic, Logical & Bitwise Operators Week # 3 Tariq Ibn Aziz.
VB .NET Programming Fundamentals
Variables & Math Operators CE 311 K - Introduction to Computer Methods Daene C. McKinney.
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
Dani Vainstein1 VBScript Session 9. Dani Vainstein2 What we learn last session? VBScript coding conventions. Code convention usage for constants, variables,
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
CHAPTER:8 OPERATORS AND EXPRESSION IN C++ Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 3: Data Types and Operators JavaScript - Introductory.
Numeric Types, Expressions, and Output ROBERT REAVES.
Chapter 2: Using Data.
CSI 3120, Expressions and assignment, page 1 Expressions and assignment Points for discussion Arithmetic expressions Overloading Logical expressions Assignment.
BUILDING JAVA PROGRAMS CHAPTER 2 PRIMITIVE DATA TYPES AND OPERATIONS.
Dani Vainstein1 VBScript Session 1. Dani Vainstein2 Subjets for Session 1 Vbscript fundamentals. Variant subtypes. Variables. Option Explicit statement.
Visual Basic IITG to be expanded. What is Visual Basic? Object Oriented Programming Language (OOP) Graphical User Interface (GUI) Event Driven – Write.
VBScript Language. What is VBScript Based on the Visual Basic family of languages Supports object oriented features Interpreted Loosely Typed Implicitly.
CPS120: Introduction to Computer Science Operations Lecture 9.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Operators Precedence - Operators with the highest precedence will be executed first. Page 54 of the book and Appendix B list C's operator precedence. Parenthesis.
COMPUTER PROGRAMMING I SUMMER Apply operators and Boolean expressions.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Variables & Function Calls. Overview u Variables  Programmer Defined & Intrinsic  Data Types  Calculation issues u Using Functions  The val() function.
Assignment statement: Assigns a value to a variable Variable must appear on the left side, value on the right side of the assignment operator Right side.
INT213-Week-2 Working with Variables. What is variable
Introduction to Programming Lecture Note - 2 Visual Basic Programming Fundamentals.
COMP Primitive and Class Types Yi Hong May 14, 2015.
Visual Basic Programming I 56:150 Information System Design.
Operators and Expressions. 2 String Concatenation  The plus operator (+) is also used for arithmetic addition  The function that the + operator performs.
CIVIL AND GEOMATIC ENGINEERING FT Okyere. CIV 257- COMPUTER PROGRAMMING Lecture 3.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
COMPUTER PROGRAMMING I SUMMER Apply operators and Boolean expressions.
Doing math In java.
3 Basics © 2010 David A Watt, University of Glasgow Accelerated Programming 2 Part I: Python Programming.
FP512 WEB PROGRAMMING 1 PREPARED BY: PN. NUR SYUHADA BINTI MOHAMAD.
Chapter 14 JavaScript: Part II The Web Warrior Guide to Web Design Technologies.
1 CS161 Introduction to Computer Science Topic #6.
CSCI 1100/1202 January 18, Arithmetic Expressions An expression is a combination of operators and operands Arithmetic expressions compute numeric.
CHAPTER FOUR Performing Calculations and Manipulating Data: Expressions.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
VBScript Session 1 Dani Vainstein.
VBScript Session 3.
VBScript Session 1 IT Professional Academy.
Exponents and Order of Operations
Multiple variables can be created in one declaration
Chapter 6 Variables What is VBScript?
Introduction to C++ Programming
Arithmetic Expressions & Data Conversions
VBScript Session 1.
Quick Test Professional Training Part 1
Algoritma & Pemrograman 1
Arithmetic Expressions & Data Conversions
Presentation transcript:

Dani Vainstein1 VBScript Session 3

Dani Vainstein2 What We learn Last seasson? How to declare arrays. Working with one dimensional a multi- dimensional arrays. Working with Dynamic arrays. Arrays utilities (Array,UBound, LBound)

Dani Vainstein3 Subjets for Session 3 Const Statement. Operators. Arithmetic. Comparision. Logical.

Dani Vainstein4 Constants Const Statement [Public | Private] Const constname = expression A constant is a meaningful name that takes the place of a number or string and never changes. VBScript defines a number of intrinsic constants. You create user-defined constants in VBScript using the Const statement.

Dani Vainstein5 Constants Const Statement You may want to adopt a naming scheme to differentiate constants from variables. This will prevent you from trying to reassign constant values while your script is running. For example, you might want to use a "vb" or "con" prefix on your constant names, or you might name your constants in all capital letters: conMaxValue, vbMyValue, MY_VALUE Differentiating constants from variables eliminates confusion as you develop more complex scripts. Const MyString = "This is my string." Const MyAge = 19 Const CutoffDate = #6-1-97#

Dani Vainstein6 VBScript Operators VBScript has a full range of operators, including arithmetic operators, comparison operators, concatenation operators, and logical operators. When several operations occur in an expression, each part is evaluated and resolved in a predetermined order called operator precedence. You can use parentheses to override the order of precedence and force some parts of an expression to be evaluated before others. Operations within parentheses are always performed before those outside.

Dani Vainstein7 VBScript Operators When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last. Comparison operators all have equal precedence; that is, they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence.

Dani Vainstein8 VBScript Operators Arithmetic Operators Exponentation operator Symbol : ^ Description: Raises a number to the power of an exponent. Syntax: result = number^exponent Note: If either number or exponent is a Null expression, result is also Null. Substraction operator Symbol : - Description: Finds the difference between two numbers or indicates the negative value of a numeric expression. Syntax: result = number1-number2 : -number Note: If one or both expressions are Null expressions, result is Null. If an expression is Empty, it is treated as if it were 0.

Dani Vainstein9 VBScript Operators Arithmetic Operators Multiplication operator Symbol : * Description: Multiplies two numbers. Syntax: result = number1*number2 If one or both expressions are Null expressions, result is Null. If an expression is Empty, it is treated as if it were 0. Division operator Symbol : / Description: Divides two numbers and returns a floating-point result. Syntax: result = number1/number2 Note: If one or both expressions are Null expressions, result is Null. If an expression is Empty, it is treated as if it were 0.

Dani Vainstein10 VBScript Operators Arithmetic Operators Integer Division operator Symbol : \ Description: Divides two numbers and returns an integer result. Syntax: result = number1\number2 Note: Before division is performed, numeric expressions are rounded to Byte, Integer, or Long subtype expressions. If any expression is Null, result is also Null. Any expression that is Empty is treated as 0.

Dani Vainstein11 VBScript Operators Arithmetic Operators Modulus arithmetic operator Symbol : Mod Description: Divides two numbers and returns only the remainder. Syntax: result = number1 Mod number2 Notes: The modulus, or remainder, operator divides number1 by number2 (rounding floating-point numbers to integers) and returns only the remainder as result. If any expression is Null, result is also Null. Any expression that is Empty is treated as 0.

Dani Vainstein12 VBScript Operators Arithmetic Operators Addition operator Symbol : + Description: Sums two numbers. Syntax: result = number1+number2 Note: Although you can also use the + operator to concatenate two character strings, you should use the & operator for concatenation to eliminate ambiguity and provide self-documenting code.

Dani Vainstein13 VBScript Operators Arithmetic Operators Concatenation operator Symbol : & Description: Forces string concatenation of two expressions. Syntax: result = expression1 & expression2 Notes: Whenever an expression is not a string, it is converted to a String subtype. If both expressions are Null, result is also Null. However, if only one expression is Null, that expression is treated as a zero-length string ("") when concatenated with the other expression. Any expression that is Empty is also treated as a zero-length string.

Dani Vainstein14 VBScript Operators Comparision Operators Equality and Inequality operators Symbol : =,, >=, <> Description: Used to compare expressions. Syntax: result = expression1 comparisonoperator expression2 Note: When comparing two expressions, you may not be able to easily determine whether the expressions are being compared as numbers or as strings. In operator Symbol : In Description: Compares two object reference variables. Syntax: result = object1 Is object2 Note: If object1 and object2 both refer to the same object, result is True; if they do not, result is False.

Dani Vainstein15 VBScript Operators Logical Operators Logical Conjuction (And) operator Symbol : Not Description : Performs logical negation on an expression. Syntax : result = Not expression If Expression isThe result is TrueFalse True Null

Dani Vainstein16 VBScript Operators Logical Operators Logical Conjuction (And) operator Symbol : And Description : Performs a logical conjunction on two expressions. Syntax : result = expression1 And expression2 The result isAnd expression2 isIf expression1 is True False True Null True FalseTrueFalse NullFalse NullTrueNull False Null

Dani Vainstein17 VBScript Operators Logical Operators Logical disjuction (Or) operator Symbol : Or Description: Performs a logical disjunction on two expressions. Syntax: result = expression1 Or expression2 The result isAnd expression2 isIf expression1 is True FalseTrue NullTrue False Null False True Null FalseNull

Dani Vainstein18 VBScript Operators Logical Operators Logical Exclusion (Xor) operator Symbol : Xor Description : Performs a logical exclusion on two expressions. Syntax : result = expression1 Xor expression2 The result isAnd expression2 isIf expression1 is FalseTrue FalseTrue False