🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: bit.listserv.script-l
1 messages
1 total messages Started by Benjamin Chi Thu, 03 Mar 1994 06:02
Re: How to test a variable
#402
Author: Benjamin Chi
Date: Thu, 03 Mar 1994 06:02
33 lines
2300 bytes
A couple of days ago I wrote:
>I have a situation where if variable vvv contains the string "XXX" I want
>one thing to happen; if it contains anything else (say, "YYY ZZZ") I want
>something else to happen.  How do I perform this test?
>
>.se vvv = 'XXX'
>.if &vvv = XXX;.th FOO;.el BAR
>.if XXX = &vvv;.th FOO;.el BAR
>
>gives  FOO BAR  when processed by SCRIPT; I should think it would give
>FOO FOO .  If I replace the first statement with
>
>.se vvv = 'YYY ZZZ'
>
>then I get the diagnostic statement
>INVALID KEYWORD FOR CONDITION ON .IF.
>'TRY' LINE 3: .if YYY ZZZ = XXX;.th FOO;.el BAR
>(which I understand), and still  FOO BAR  as output.
>
>Questions:
>(1) Why aren't the two .if statements in either of the two examples
>entirely equivalent?
>(1a) Why didn't I get the same diagnostic for line 2 of the second
>example?
>(2) What is the syntactically correct way to test the contents of a
>variable whose value may be a string with embedded spaces?

Mark Lawrence at Stanford was kind enough to reply with some suggestions
about how to get these tests to succeed.  Unfortunately he tested them
with Waterloo Script, whereas the problem I am having is with use of
DCF 4.0 for which his suggestions provide no relief.  Anybody else have
any ideas?
                                             /b
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads