Array compare: with syntax error ?

Just starting out? Need help? Post your questions and find answers here.
vmars316
Enthusiast
Enthusiast
Posts: 474
Joined: Fri Jun 29, 2012 12:24 am
Contact:

Array compare: with syntax error ?

Post by vmars316 »

Hello & Thanks ,
I am studying the code below .
When I try to compile it , up comes an error msg (Line 29 Syntax error) .
Line 29 = For inside = 0 To Number
Unfortunately , I can't see the error .
Anyone ?

Code: Select all

; German forum: http://www.purebasic.fr/german/archive/viewtopic.php?t=970&highlight=
; Author: mutzel.man
; Date: 11. May 2003
; OS: Windows
; Demo: Yes
; Would like to check if the contents of Array1 can be found in Array 2.
; => If so do nothing
; => If No, write value to new array (Array3).
Global Number.l = 4 , DummyNumber.l = 0 , Found.l = 0 , inside = 0 , outside = 0 

Dim dummy1.s (Number)
Dim dummy2.s (Number)
Dim dummy3.s (Number)

Dummy1 (0) = "Test0"
Dummy1 (1) = "Test1"
Dummy1 (2) = "Test2"
Dummy1 (3) = "Test3"
Dummy1 (4) = "Test4"

Dummy2 (0) = "Test0"
Dummy2 (1) = "1Test"
Dummy2 (2) = "Test2"
Dummy2 (3) = ""
Dummy2 (4) = "Test2"

For outside = 0 To Number

  For inside = 0 To Number
    If dummy1 (outside) = dummy2 (inside)
      Found = 1
    EndIf
  Next inside
  
  If found = 0
    Dummy3 (DummyNumber) = dummy1 (outside)
    DummyNumber = DummyNumber + 1
  Else
    Found = 0
  EndIf
  
Next outside

For test = 0 To DummyNumber
  Debug dummy3 (test)
Next

End 
Thanks
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Array compare: with syntax error ?

Post by skywalk »

I have no errors.
It is most likely a hidden character.
Copy your code into Notepad++ or a Hex editor to see any stray special characters.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
vmars316
Enthusiast
Enthusiast
Posts: 474
Joined: Fri Jun 29, 2012 12:24 am
Contact:

Re: Array compare: with syntax error ?

Post by vmars316 »

skywalk , Thanks ,
You're on the right trail :
I found an answer here:
http://stackoverflow.com/questions/2088 ... with-regex
And I went with this option:
In Notepad++ Another good trick is to go into UTF8 mode in your editor so that you can actually see these funny characters and delete them yourself.
Prog works fine now .
Thanks
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
Post Reply