12-21-2017, 09:25 PM
Far from a Scheme expert(*), but I would expect to do something like:
that would entirely side-step the issue.
Also it is usually considered good style to use "guard clauses" to avoid putting the bulk of the code in a nested condition. In other words, instead of doing:
Good style would be:
This becomes even more necessary when you have several conditions.
(*) We are in the third millennium, why don't you use Python instead of a 1950-era language?
Code:
(if (> ((string-length g1Text) 0)
Also it is usually considered good style to use "guard clauses" to avoid putting the bulk of the code in a nested condition. In other words, instead of doing:
Code:
if (some-condition)
do a lot of things
else
complain about some-condition not met
endif
return
Code:
if (not some-condition)
complain and return
# from that point everything is fine...
do a lot of things
return
This becomes even more necessary when you have several conditions.
(*) We are in the third millennium, why don't you use Python instead of a 1950-era language?