Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 19:36 26 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Can you (would you) += in MMBasic

     Page 4 of 4    
Author Message
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 10:08pm 19 Jan 2024
Copy link to clipboard 
Print this post

greatcowbasic lets you use a++ instead of a=a+1
also a--- instead of a=a-1
but a++b instead of a=a+b would be better.
inc is ok. what if it's float?
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 11:23pm 19 Jan 2024
Copy link to clipboard 
Print this post

Thanks Geoff, I don't think the good old Micromite is fully appreciated by many of the newer shedders and many could learn a lot from reading the articles on your website.

@Stan
  stanleyella said  inc is ok. what if it's float?

Easy enough to test:




Bill
Keep safe. Live long and prosper.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 12:48am 20 Jan 2024
Copy link to clipboard 
Print this post

  Turbo46 said  Easy enough to test:


You get a more reasonable result of 2.25 if you include the comma before 0.5
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 01:05am 20 Jan 2024
Copy link to clipboard 
Print this post

Doh! Thanks Lizby without the comma it is just incrementing by one and ignoring the 0.5. I wasn't paying proper attention.

Bill
Keep safe. Live long and prosper.
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 339
Posted: 04:51am 20 Jan 2024
Copy link to clipboard 
Print this post

  karjo238 said  
I was going to also ask whether it would be possible to fill arrays in a single line, i.e.:


Dim a

a = (202,80,50,60,0,0,0)


As opposed to:


Dim a

a(1) = 202
a(2) = 80
a(3) = 50
a(4) = 60
...




If you wanted to do that, it would be better to follow what official BASIC already uses:

MAT READ a
DATA 202,80,50,60,0,0,0

Edited 2024-01-20 14:52 by toml_12953
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 05:21am 20 Jan 2024
Copy link to clipboard 
Print this post

Dim a(6) = (202,80,50,60,0,0,0)

> list
Dim a(6) = (202,80,50,60,0,0,0)
For b = 0 To 6 : Print a(b): Next
> run
202
80
50
60
0
0
0
>


Note: zero base array

Bill
Keep safe. Live long and prosper.
 
     Page 4 of 4    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024