mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merged with upstream. Updated M (aka MUMPS) detection to use the new bayesian / samples method.
This commit is contained in:
46
samples/M/postconditional.m
Normal file
46
samples/M/postconditional.m
Normal file
@@ -0,0 +1,46 @@
|
||||
;
|
||||
; M code examples contrasting postconditionals with IF-commands
|
||||
;
|
||||
post1 ; postconditional in set command
|
||||
set a=5
|
||||
set b=10
|
||||
set c=25
|
||||
I 0 ;purposely set $TEST to false
|
||||
write "$TEST special variable (before post-condition)=",$TEST
|
||||
set:(a<b) c=b
|
||||
write "$TEST special variable (after post-condition) =",$TEST
|
||||
write "c =",c,!
|
||||
quit
|
||||
;
|
||||
post2 ; postconditional in write command
|
||||
set a=5
|
||||
set b=10
|
||||
I 0 ;purposely set $TEST to false
|
||||
write "$TEST special variable (before post-condition)=",$TEST
|
||||
write:(a<b) "variable a=",a," is smaller than b=",b,!
|
||||
write "$TEST special variable (after post-condition) =",$TEST
|
||||
write:(a>b) "variable a=",a," is larger than b=",b,!
|
||||
write "$TEST special variable (after post-condition) =",$TEST
|
||||
quit
|
||||
;
|
||||
if1 ; if command
|
||||
set a=5
|
||||
set b=10
|
||||
set c=25
|
||||
I 0 ;purposely set $TEST to false
|
||||
write "$TEST special variable (before IF)=",$TEST
|
||||
if (a<b) set c=b
|
||||
write "$TEST special variable (after IF) =",$TEST
|
||||
write c,!
|
||||
quit
|
||||
;
|
||||
if2 ; postconditional in write command
|
||||
set a=5
|
||||
set b=10
|
||||
I 0 ;purposely set $TEST to false
|
||||
write "$TEST special variable (before IF)=",$TEST
|
||||
if (a<b) write "variable a=",a," is smaller than b=",b,!
|
||||
write "$TEST special variable (after IF) =",$TEST
|
||||
if (a>b) write "variable a=",a," is larger than b=",b,!
|
||||
write "$TEST special variable (after IF) =",$TEST
|
||||
quit
|
||||
Reference in New Issue
Block a user