Lartu / ldpl

COBOL-like programming language that compiles to C++. With serious dinosaurs with neckties and briefcases 🦕💼
https://www.ldpl-lang.org/
Apache License 2.0
160 stars 24 forks source link

INCR & DECR statements #89

Closed xvxx closed 5 years ago

xvxx commented 5 years ago

These might be redundant because you can just do add 1 and var in var, but I tend to do that a lot so thought this might be worth exploring. Tests are in Lartu/ldpltest#4.

Example:

DATA:
n is number

PROCEDURE:
while n is less than 100 do
  display "n: " n crlf
  incr n
repeat

display "final: " n crlf

Wasn't sure about INCR vs INCREMENT too?

Lartu commented 5 years ago

I love this! Thank you!

Lartu commented 5 years ago

I would stay with INCR for the time being. INCREMENT is more expressive, but if you are using INCR is because you don't want to write much, and INCREMENT is just overkill :laughing: