cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with comparing a string with a variable

Problems with comparing a string with a variable

EtherNation_Use
Contributor II
Create Date: Jul 11 2013 2:15PM

Hi,

I want to compare the content of a variable with a string, but it doesn't works.

Here the posting of some examples and the error messages which I get:

# variables
set var count 0
set var par1 "Image"

# example 1
set var count ($count + 1)
show var count
while ("$par1" != "Image") DO
show var $par1
endwhile
# Message:
# Error:can't read "par1": no such variable
# Variable Image not found.
# Error: Mismatched ENDWHILE



# example 2
set var count ($count + 1)
show var count
while ("Image" != "Image") DO
show var $par1
endwhile
# No Error-Message

# example 3
set var count ($count + 1)
show var count

while (part1 != "Image") DO
show var $par1
endwhile
#Error-Message:
#Error:syntax error in expression "(part1 != "Image")"

#Variable Image not found.
#Error: Mismatched ENDWHILE

Does somebody knows the rigth syntax?

(from Hans_Vedder)
5 REPLIES 5

EtherNation_Use
Contributor II
Create Date: Jul 11 2013 4:31PM

Hi,

try -> while ( $par1 != "Image")

Jarek (from Jaroslaw_Kasjaniuk)
GTM-P2G8KFN