| View previous topic :: View next topic |
| Author |
Message |
romain Voice
Joined: 16 Oct 2005 Posts: 12
|
Posted: Sat Dec 10, 2005 11:47 am Post subject: Problem with <,<= |
|
|
Hello ,
I've this script
| Code: | for {set i 0} {$i < [lindex $a 0]} {incr i} {
if {0 < [lindex $a 0] <=5} {
##blabla
if {$i == [lindex $a 0]} {
##blabla
}
} elseif {5 < [lindex $a 0] <= 10} {
##blabla
if {$i == 5} {
##blabla
} elseif {$i == [lindex $a 0]} {
##blabla
}
}
} |
But don't works  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Dec 10, 2005 12:09 pm Post subject: |
|
|
| Quote: | | } elseif {5 < [lindex $a 0] <= 10} { |
You mean
| Code: | | } elseif {5 < [lindex $a 0] && [lindex $a 0] <= 10} { |
And is [lindex $a 0] a number? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
romain Voice
Joined: 16 Oct 2005 Posts: 12
|
Posted: Sun Dec 11, 2005 2:19 am Post subject: |
|
|
Thx Sir_Fz.
Yes it's a number. How verifier who a list is well a list of number?
| Code: | | regexp {\d} [split $list] |
 |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Dec 11, 2005 3:41 am Post subject: |
|
|
| romain wrote: | Thx Sir_Fz.
Yes it's a number. How verifier who a list is well a list of number?
| Code: | | regexp {\d} [split $list] |
 |
now if you get this, you deserve to work for the NSA  _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
romain Voice
Joined: 16 Oct 2005 Posts: 12
|
Posted: Sun Dec 11, 2005 5:58 am Post subject: |
|
|
Lol demond,
i write now for work for the NSA
Just, i have this code
| Code: | foreach d [split $list] {
if [regexp {\d} $d] {
putlog "$d is a number"
} else {
putlog"$d is not a number"
}
} |
It's good?
If yes, it's not possible to make more simple and fast for verify if a list is just a number list  |
|
| Back to top |
|
 |
BarkerJr Op

Joined: 30 Mar 2003 Posts: 104
|
Posted: Sun Dec 11, 2005 10:24 am Post subject: |
|
|
| I think you want \d+, right? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
|