Is (operator): Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "''result'' = ''object1'' IS ''object2'' '''Description''' IS returns a boolean specifying if one object reference is identical to another. The required components, ''object1...")
 
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
''result'' = ''object1'' IS ''object2''
''result'' = ''object1'' Is ''object2''


'''Description'''
== Description ==


IS returns a boolean specifying if one object reference is identical to another. The required components, ''object1'' and ''object2'' are two object references.
Is returns a boolean specifying if one object reference is identical to another. The required components, ''object1'' and ''object2'' are two object references.
 
== Example''' ==


'''Example'''
<pre>
<pre>
REM IS Example
Rem Is Example
DIM Obj1,Obj2
Dim Obj1,Obj2
Obj1 = Array("Lovelace","Hopper","Allen")
Obj1 = Array("Lovelace","Hopper","Allen")
SET Obj2 = Obj1
Set Obj2 = Obj1
CompareObjects Obj1, Obj2
CompareObjects(Obj1, Obj2)
SET Obj2 = NOTHING
Set Obj2 = NOTHING
CompareObjects Obj1, Obj2
CompareObjects(Obj1, Obj2)
missing=6
missing=6
notmissing=7
notmissing=7
CompareObjects missing, notmissing
CompareObjects(missing, notmissing)
SUB CompareObjects(Ob1, Ob2)
 
   IF Ob1 IS Ob2 THEN
Sub CompareObjects(Ob1, Ob2)
     PRINT "Same"
   If Ob1 Is Ob2 Then
   ELSE
     Print "Same"
     PRINT "Different"
   Else
   END IF
     Print "Different"
END SUB
   End If
End Sub
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Same
Same
Different
Different
Different
</pre>
</pre>


'''Related Items'''
== Related Items ==
 
[[Category:Language Reference]]


[[addobject|ADDOBJECT]], [[set|SET]]
[[Category:Logical Operators]]

Latest revision as of 19:14, 28 August 2012

result = object1 Is object2

Description

Is returns a boolean specifying if one object reference is identical to another. The required components, object1 and object2 are two object references.

Example

Rem Is Example
Dim Obj1,Obj2
Obj1 = Array("Lovelace","Hopper","Allen")
Set Obj2 = Obj1
CompareObjects(Obj1, Obj2)
Set Obj2 = NOTHING
CompareObjects(Obj1, Obj2)
missing=6
notmissing=7
CompareObjects(missing, notmissing)

Sub CompareObjects(Ob1, Ob2)
  If Ob1 Is Ob2 Then
    Print "Same"
  Else
    Print "Different"
  End If
End Sub

Output

Same
Different
Different

Related Items