
-----------------------------------
Namis
Mon Sep 22, 2003 1:52 pm

Problem - Is there a different command for or?
-----------------------------------
Im getting an error for this, whats wrong with it?

if z = "Yes"
or "yes"
or "YES"
or "yEs"
or "yES"
or "YeS"
else exit
end if

-----------------------------------
Tony
Mon Sep 22, 2003 3:43 pm


-----------------------------------
because you're not doing it right. The way OR (AND NOR, etc) acts, is that they compare two values around itself and produces a result.

z = "Yes" produces true

"yes" by itself doesnt produce a boolean value so you get an error because OR cant compare two sides.

the proper way of doing it is:

if z="Yes" or z="yes" or z=...


-----------------------------------
Dan
Mon Sep 22, 2003 4:10 pm


-----------------------------------
i think a case could be of help here (called a switch in most other languses)

ex. 

case z of
   label "Yes", "yes", "YES", "yEs", "yES", "YeS": put "yes was in z"
   label : exit
end case


but i think there may be a fuction that checks to see if it is the same worad but in dif caps wich whould wrok better (or is that just in c/c++?)

-----------------------------------
Tony
Mon Sep 22, 2003 4:55 pm


-----------------------------------
most languages have compareStringIgnoreCase function. Well atleast Java does  :wink: 

Turing might have that too. If not, could someone write it and post it in Turing Submitions? Might be useful.

-----------------------------------
krishon
Mon Sep 22, 2003 4:55 pm


-----------------------------------
i wuz gonna say use elsifs but it'll be a hastle

-----------------------------------
Martin
Mon Sep 22, 2003 6:51 pm


-----------------------------------
Here's the code for a toUpperCase function...haven't done turing in a while so this might be buggy


function toUpperCase (word:string):string
  var word2 : string := ""
  for i:1..length(word)
    if word (i) >= 'a' and word (i) 