This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| crpl:docs:eq [2013/12/03 17:38] – Added not on comparing unlike types Grauniad | crpl:docs:eq [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ~~DISCUSSION~~ | + | |
| <- [[crpl: | <- [[crpl: | ||
| ===== eq ===== | ===== eq ===== | ||
| Line 13: | Line 13: | ||
| === Comparing unlike types === | === Comparing unlike types === | ||
| When trying to do a comparison where one argument is a string and the other is an int, the string gets coerced into an int. If the string is something like " | When trying to do a comparison where one argument is a string and the other is an int, the string gets coerced into an int. If the string is something like " | ||
| + | |||
| + | In particular, if x may be a string or number, (<-x " | ||
| The ' | The ' | ||
| Line 26: | Line 28: | ||
| 45 50 gt # False, 45 is not greater than 50 | 45 50 gt # False, 45 is not greater than 50 | ||
| 50 50 gt # False, 50 is not greater than 50</ | 50 50 gt # False, 50 is not greater than 50</ | ||
| + | |||
| + | Examples of comparing with unlike types | ||
| + | < | ||
| + | " | ||
| + | 0 ->zero | ||
| + | 1 ->one | ||
| + | Trace(< | ||
| + | Trace(< | ||
| + | |||
| + | " | ||
| + | Trace(< | ||
| + | Trace(< | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | # If core doesn' | ||
| + | # Then " | ||
| + | Trace(GetScriptVar(< | ||
| + | # The following version returns TRUE only if core has Script.crpl attached with | ||
| + | # a variable " | ||
| + | Trace(GetScriptVar(< | ||
| + | </ | ||