if and elsif help
Author |
Message |
gagster1233
|
Posted: Thu Nov 05, 2009 7:40 pm Post subject: if and elsif help |
|
|
What is it you are trying to achieve?
divide a class into two groups depending on the first letter of their last name a-h (Group 1) i-z (Group 2)
What is the problem you are having?
cant get the program to recognize the letters to sort them using "if"
Describe what you have tried to solve this problem
Different variables (cant try much still new to programming)
Please specify what version of Turing you are using
4.1.1 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Kharybdis
|
Posted: Thu Nov 05, 2009 8:04 pm Post subject: RE:if and elsif help |
|
|
Well, post the code to see what you have come up with so far so we can help you. |
|
|
|
|
|
Superskull85
|
Posted: Thu Nov 05, 2009 10:39 pm Post subject: RE:if and elsif help |
|
|
To get the first character of any string variable use MyString (1). You can than compare the first letters by finding the ordinal (ord (MyChar)) value of each letter and seeing if the letter is within the letter ordinals in Turing's character set (found in the Turing help files called "Run Window Character Set").
Another useful function to use is Str.Lower (MyString) (or Str.Upper (MyString)) as the function will convert the case of the first letter so that it is always in lower case (or upper case).
If you post your code than we might be able to help you expand on the code you have already written. |
|
|
|
|
|
|
|