Dot cleaning...
Hi!
I'm trying to clean some dots from old stuff, do you think this two versions of code works the same way ? :
DOT VERSION
Use fic
Read *R:20 Else Do Quit ;;;; comando else aplicado a read.
. Use 0 Write !!!,"Expired time."
If $c(R)="a" d
. Use 0 Write !!!,"A letter a has been read."
. Quit
LITTLE BIT MODERN VERSION
Use fic
Read *R:20
If $Test {
Use 0 Write !!!,"One character read"
Quit
}
Else {
Use 0 Write !!!,"Expired time."
}
Thanks!
Comments
Is NOT the same. You can it prove by adding a label to the line with the read command and a new line at the end
// DOT VERSION// Use fic
old Read *R:20ElseDoQuit;;;; comando else aplicado a read.
. Use0Write !!!,"Expired time."If$c(R)="a"d
. Use0Write !!!,"A letter a has been read."
. Quitwrite !,"If there are more lines, they will be executed",!
quit// LITTLE BIT MODERN VERSION// Use ficnewRead *R:20If$Test {
Use0Write !!!,"One character read"Quit
}
Else {
Use0Write !!!,"Expired time."
}
write !,"If there are more lines, they will be executed",!
quitnow let run both of them...
do old // let the timeout occurdo old // now with some inputdonew// let the timeout occurdonew// now with some inputDo you see the difference? If there are more lines (at end) they will be executed in opposite cases (timeout/notimeout)
You're right of course, thanks!!!
The main thing I want is to avoid that "else" old format on "read"'s ... thinkin' in an "automatic parser" to translate old code but it seems a bit complex due to this particularities.
Another translation is
Read *R:20
;; Test error case
If '$Test { Use 0 Write !!!,"Expired time." Quit }
;; Test character "a" case
If $c(R)="a" {
Use 0 Write !!!,"A letter a has been read."
Quit
}
;; I added more code here to demonstrate "fall through" in original
;; when neither timeout nor "a" occurs
Use 0
Write !,"A character other than ""a"" was read"
Quit
;; Since all 3 cases execute Use 0, this statement can be placed after Read and the other 3 copies deleted
Thanks Steven, that's right :)