|
|
|
тип булеан
|
|||
|---|---|---|---|
|
#18+
Всем привет! Объясните что не так? Почему 1 интерпретируется и как true и как false? Создаю vbscript ----------------------------------------- GLOBAL_FAIL = -1 if GLOBAL_FAIL then WScript.echo GLOBAL_FAIL & " - true" end if if not GLOBAL_FAIL then WScript.echo GLOBAL_FAIL & " - false" end if GLOBAL_FAIL = 0 if GLOBAL_FAIL then WScript.echo GLOBAL_FAIL & " - true" end if if not GLOBAL_FAIL then WScript.echo GLOBAL_FAIL & " - false" end if GLOBAL_FAIL = 1 if GLOBAL_FAIL then WScript.echo GLOBAL_FAIL & " - true" end if if not GLOBAL_FAIL then WScript.echo GLOBAL_FAIL & " - false" end if ----------------------------------------- Вывод: ----------------------------------------- -1 - true 0 - false 1 - true 1 - false ----------------------------------------- ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.11.2008, 15:57 |
|
||
|
тип булеан
|
|||
|---|---|---|---|
|
#18+
noob v0.1, потому что логические операции выполняются побитно, а выражение в If сравнивается с нулём. Если 0, выполняется ветка else, если не 0 - ветка then. Итого: -1 <> 0 Not -1 = 0 = 0 0 = 0 Not 0 = -1 <> 0 1 <> 0 Not 1 = -2 <> 0 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.11.2008, 17:54 |
|
||
|
|

start [/forum/topic.php?fid=60&gotonew=1&tid=2161582]: |
0ms |
get settings: |
8ms |
get forum list: |
18ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
151ms |
get topic data: |
11ms |
get first new msg: |
5ms |
get forum data: |
2ms |
get page messages: |
47ms |
get tp. blocked users: |
2ms |
| others: | 201ms |
| total: | 451ms |

| 0 / 0 |
