Smaller than/bigger than
Posted: Mon Jul 12, 2010 9:46 am
What's the script for smaller than and bigger than? I have tried "<" and ">" but doesn't work..

Questions and answers about the LiveCode platform.
https://www.forums.livecode.com/
Code: Select all
on mouseUp
if field testfield1 < 18 then
put 5 into field testfield2
end if
end mouseUp
Code: Select all
put "First" into testfield1
put "Second" into testfield2
Code: Select all
if field testfield1 < 18 then
Code: Select all
on mouseUp
put "First" into testfield1
put "Second" into testfield2
put empty into field testfield2
if field testfield1 is not a number then
beep 1
answer "Please enter a number into the first field"
pass mouseUp
end if
if field testfield1 < 18 then
put 5 into field testfield2
end if
end mouseUp
Code: Select all
put "First" into testfield1
put "Second" into testfield2
Code: Select all
put field testfield1 into First
put field testfield2 into Second
Code: Select all
on mouseUp
if field testfield1 < 18 then put 5 into field testfield2
end mouseUp
Code: Select all
on mouseUp
if field "Test" = 3 then beep 1
end mouseUp
Code: Select all
on mouseUp
if field "Test" = 3 then
beep 1
answer "Hello Coder!"
beep 1
end if
end mouseUp
Code: Select all
on mouseUp
put "First" into testfield1
put "Second" into testfield2
put empty into field testfield2
if field testfield1 is not a number then
beep 1
answer "Please enter a number into the first field"
pass mouseUp
end if
if field testfield1 < 18 then
put 5 into field testfield2
end if
end mouseUp
Code: Select all
on mouseUp
put empty into field "Second"
if field "First" is not a number then
beep 1
answer "Please enter a number into the first field"
pass mouseUp
end if
if field "First" < 18 then
put 5 into field "Second"
end if
end mouseUp
There is an important difference between these statements:When you put the fields into variables..I would do that like this:Code: Select all
put "First" into testfield1 put "Second" into testfield2
Code: Select all
put field testfield1 into First put field testfield2 into Second
Code: Select all
put "First" into testfield1
Code: Select all
global testfield1, testfield2
on mouseEnter
put "First" into testfield1
put "Second" into testfield2
end mouseEnter
on mouseUp
put empty into field testfield2
if field testfield1 is not a number then
beep 1
answer "Please enter a number into the first field"
pass mouseUp
end if
if field testfield1 < 18 then
put 5 into field testfield2
end if
end mouseUp
Code: Select all
on mouseEnter
put "Third" into testfield1
put "Fourth" into testfield2
end mouseEnter
Code: Select all
put field testfield1 into First
Code: Select all
put 10 into first
Code: Select all
on mouseUp
go to the first card of this stack
end mouseUp
Code: Select all
put field testfield1 into firstValue
put field testfield2 into secondValue
Code: Select all
on mouseUp
put field testfield1 into firstValue
put field testfield2 into secondValue
if firstValue < secondValue then
put firstValue * secondValue into field testfield3
beep 1
wait 1 second
beep 1
end if
end mouseUp
Code: Select all
put "MyFirstField" into testfield1
Code: Select all
put field testfield1 into firstValue
Code: Select all
on mouseUp
put "MyFirstField" into testfield1
put field testfield1 into firstValue
answer firstValue
end mouseUp