Re: If Statements
Re: If Statements
- Subject: Re: If Statements
- From: Skeeve <email@hidden>
- Date: Fri, 12 Sep 2008 08:43:38 +0200
Ed Stockly schrieb:
That's probably not going to work Ed becuase I suspect userName is
always a string.
If userName were always a string, then
If (username > 1 and username <10)
would never work.
Of course Tim is right.
Test it for yourself
test_something("abc")
log "----------"
test_something("123")
log "----------"
test_something(123)
on test_something(something)
log something
log (class of something)
try
something as number
log "Number"
if something > 100 then
log "> 100"
else
log "<= 100"
end if
on error
log "String"
end try
end test_something
As you will see from the output:
(*abc*)
(*string*)
(*String*)
(*----------*)
(*123*)
(*string*)
(*Number*)
(*> 100*)
(*----------*)
(*123*)
(*integer*)
(*Number*)
(*> 100*)
"123" is of class string and so your "Stringthing" will always be done.
Nevertheless coercing it to a number gives you a number and you still
can compare that string to numbers.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden