## Re: unique question?

Expand Messages
• ... delimited ... MOD ... Okay, here s things the get me stuck. What the hell is: WHILE i
Message 1 of 11 , Jun 4 9:48 AM
--- In libertybasic@yahoogroups.com, "alex0hay" <zenjew@...> wrote:
>
> numpossnames = 10
> DIM sum(numpossnames)
>
> name\$ = "JOE SAMUEL ELIAS SMITH" 'must be caps here, names
delimited
> by 1 space,
> 'could accomodate lower case using
> UCASE\$
> ' RTFM (Read The F'ing Manual)
>
> i = 1 'simple counter
> n = 1 'start at first name
>
> WHILE i <= LEN(name\$)
> x = ASC(MID\$(name\$, i, 1))
> IF x = 32 THEN 'it's a space so skip
> n = n + 1 'and move to next name
> i = i + 1 'and next character in name\$
> x = ASC(MID\$(name\$, i, 1)) 'better not be a space
> END IF 'in all cases '
> sum(n) = sum(n) + 1 + (x - 65) MOD 9 'ASC("A")=65, RTFM re:
MOD
> i = i + 1
> WEND
>
> FOR i = 1 TO n 'n = number of names found
> WHILE sum(i) > 9
> sum(i) = sum(i) - 9 'sum(i) MOD 9, preserving 0 as 9,
> RTFM:)
> WEND
> tot = tot + sum(i)
> NEXT
>
> WHILE tot > 9
> tot = tot - 9 'ditto last remark
> WEND
>
> FOR i = 1 TO n
> PRINT "name"; i; sum(i)
> NEXT
> PRINT "all names "; tot
> PRINT
>

Okay, here's things the get me stuck. What the hell is: WHILE i <= LEN
(name\$) I am more concerned with the [i] in this statement, I have
read the manual and unless i've completely missed something I have no
clue what this i is in the statement, i've also seen it in the usage
of for index xxxxxxx what in the hell is index? I went to look up the
commands in the manual and could not find a listing of any command or
terms that describe what index means to the language...

why are we using i, what is it, and what does it mean? seems to me
that there were a few other terms that i saw being used that were
used in the program but not mentioned anywhere in the book.

unless im looking in the wrong manuals???
• ... Have you worked through the tutorials that come with Liberty BASIC? In the helpfile: Language Syntax and Usage - Variables, Arrays and DATA. If you don t
Message 2 of 11 , Jun 4 10:35 AM
At 11:48 AM 6/4/2006, you wrote:

>Okay, here's things the get me stuck. What the hell is: WHILE i <= LEN
>(name\$) I am more concerned with the [i] in this statement, I have
>read the manual and unless i've completely missed something I have no
>clue what this i is in the statement, i've also seen it in the usage
>of for index xxxxxxx what in the hell is index? I went to look up the
>commands in the manual and could not find a listing of any command or
>terms that describe what index means to the language...
>
>why are we using i, what is it, and what does it mean? seems to me
>that there were a few other terms that i saw being used that were
>used in the program but not mentioned anywhere in the book.
>
>unless im looking in the wrong manuals???

Have you worked through the tutorials that come with Liberty BASIC?

In the helpfile: Language Syntax and Usage -> Variables, Arrays and DATA.

If you don't know what a variable is, you are at the beginning of
your journey to learn programming. It will get easier as you learn
more. I highly recommend working through the tutorial, which can be

-Alyce

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.394 / Virus Database: 268.8.1/355 - Release Date: 6/2/2006
• Okay, here s things the get me stuck. What the hell is: WHILE i
Message 3 of 11 , Jun 5 4:27 AM
" Okay, here's things the get me stuck. What the hell is: WHILE i <= LEN
(name\$) I am more concerned with the [i] in this statement, I have
read the manual and unless i've completely missed something I have no
clue what this i is in the statement, i've also seen it in the usage
of for index xxxxxxx what in the hell is index? I went to look up the
commands in the manual and could not find a listing of any command or
terms that describe what index means to the language..."

jmoylan

'i' is simply used as a variable. any letter or name could be used just as
well. Descriptive names such as 'counter', 'index', or something
describing the variable's useage might be better.

Now to the heart of the matter. This is a public group. There are some
here who are offended by your use of 'four letter words', myself for one.
that in a public group such as this, you find non offensive words to convey

Bill
• ... LEN ... In this particular instance this line of code WHILE i
Message 4 of 11 , Jun 7 4:27 PM
--- In libertybasic@yahoogroups.com, "William Roggow" <roggowb@...>
wrote:
>
> " Okay, here's things the get me stuck. What the hell is: WHILE i <=
LEN
> (name\$) I am more concerned with the [i] in this statement, I have
> read the manual and unless i've completely missed something I have no
> clue what this i is in the statement, i've also seen it in the usage
> of for index xxxxxxx what in the hell is index? I went to look up the
> commands in the manual and could not find a listing of any command or
> terms that describe what index means to the language..."
>
> jmoylan
>

In this particular instance this line of code "WHILE i <= LEN
(name\$)" is part of a counting loop, I being the counter and it will
count up to the number of character contained in string name\$. as an
example:

name\$= "My Name":i=0
while i<= LEN(name\$)
i=i+1
wend
print "length of string variable name\$ = ";i-1

I hope this helps you out.
Your message has been successfully submitted and would be delivered to recipients shortly.