If...Then

Post your requests and ideas on the future development of mikroBasic.
Post Reply
Author
Message
arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

If...Then

#1 Post by arco » 03 Oct 2008 12:58

It would be very nice if one-line if...then loops were allowed for simple tests, allowing for writing more compact sourcecode.

Code: Select all

If x=1 then y=0
Or:

Code: Select all

If x=1 Then y=0 Else z=2
Most Basic dialects allow this usage...
Regards,

Peter.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#2 Post by yo2lio » 03 Oct 2008 13:48

Sorry but I don't understand your wishes ...

The lines like this :

Code: Select all

if xx = 5 then zz = 7 else yy = 3 end if 
works OK in MikroBasic.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

#3 Post by arco » 03 Oct 2008 15:38

Thanks,

Never tried it with End If at the and. (All other Basic dialects I ever used had the If...Then...Else syntax without End If on one-liners...)
Regards,

Peter.

arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

#4 Post by arco » 04 Oct 2008 01:02

Also use of Unions for Type Structures or dimensioning multiple 'overlapping' types at the same location would be very helpful.

Code: Select all

Structure MyStructure1
  Dim Var1 As Byte
  Dim Var2 As Byte
  Dim Var3 As Word
End Structure  

Structure MyStructure2 At MyStructure1
  Dim Var4 As String[4]
End Structure
This would allow both structures to occupy the same memory locations.
Regards,

Peter.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#5 Post by yo2lio » 04 Oct 2008 07:35

:idea: Use absolute directive :

Code: Select all

Structure MyStructure1
  Dim Var1 As Byte
  Dim Var2 As Byte
  Dim Var3 As Word
End Structure

Structure MyStructure2
  Dim Var4 As String[4]
End Structure

dim aaa as MyStructure1 absolute $100
    bbb as MyStructure2 absolute $100
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

#6 Post by arco » 04 Oct 2008 12:58

Use absolute directive
Yes, I know that, but I don't need fixed addresses, I just want them at the same address...
Regards,

Peter.

Post Reply

Return to “mikroBasic Wish List”