Page 1 of 1

LEN command

Posted: Mon May 03, 2021 11:41 pm
by NoSwaze
I'm struggling to work out how to use the LEN command to work out the amount of characters a word that the user enters has. Could anyone give me an example on how to do it please?

Re: LEN command

Posted: Tue May 04, 2021 12:20 am
by garmeister
isn't 'len' a Python method? I believe LiveCode uses 'length'

Example: the length of "ABC" -- returns 3

Re: LEN command

Posted: Tue May 04, 2021 12:28 am
by garmeister

Re: LEN command

Posted: Tue May 04, 2021 12:44 am
by garmeister
I'm not sure if this is what you're trying to do or if there is a better way. I'm learning LC myself.

I wrote this bit of code and it works :D

Code: Select all

on mouseUp pButtonNumber
   ask "Enter some text"
   put it into aWord
   answer "Your text has " & length(aWord) & " letters in it."
end mouseUp

Re: LEN command

Posted: Tue May 04, 2021 2:01 am
by FourthWorld
Hello, NoSwaze. What are you building with LiveCode?

Re: LEN command

Posted: Tue May 04, 2021 2:41 am
by dunbarx
Going back to the beginning, "len" is a synonym for "length". I don't particularly like it, and never use it.

Craig

Re: LEN command

Posted: Tue May 04, 2021 7:13 am
by garmeister
So, 'len' is a synonym of 'length' afterall. Good to know :D