Can anyone explain me how to shorten the code I use?

Ken Ray kray at sonsothunder.com
Wed Mar 15 10:31:50 EST 2006


On 3/15/06 6:51 AM, "William de Smet" <wdesmet at wanadoo.nl> wrote:

> Hi there,
> I've picked up Rev today after a while and started a new app.
> I noticed how it amused me again but there is still one thing I don't
> understand: I have repeating code and I don't know how to shorten it.

Try this:

if the text of field "naam1" = empty then
  repeat with x = 1 to 25
    if the selectedText of btn "naam1nivo" = x then
      answer error "Naam van leerling 1 mag niet leeg zijn!"
    end if
  end repeat
  if the selectedText of btn "naam1nivo" = "... then
    put "" into tData
  else 
    put field "naam1" && the selection of button "naam1nivo" &cr into tData
  end if
else  -- text field not empty
  if the selectedText of btn "naam1nivo" = "... then
    answer error "Niveau van leerling 1 mag niet leeg zijn!"
  end if
end if

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list