Hello,
For learning and testing "trigon" library, i write a very smal program :
dim angle as float
main:
for angle = 0 to 3.14 step 0.01
......
next
I can't make HEX, I have errors : 'Syntax error : Expected "integral type" but "float" found' and 'Argument is out of range "0" to "float"'.
I don't understand, "integer" can't have decimal value ? how can I do a loop with decimal value ?
Thank you for all
Jean-Paul
for... next loop
-
- Posts: 13
- Joined: 10 Sep 2011 20:37
- Location: FRANCE - Pays de la Loire
-
- Posts: 13
- Joined: 10 Sep 2011 20:37
- Location: FRANCE - Pays de la Loire
Re: for... next loop
Excuse me,
I see I write in a wrong thread,
I also have some difficulty with english ! not only with MikroBasic.
Jean-Paul
I see I write in a wrong thread,
I also have some difficulty with english ! not only with MikroBasic.
Jean-Paul
-
- Posts: 125
- Joined: 25 Sep 2012 23:51
- Location: Sweden
Re: for... next loop
I dont know the syntax in basic. I use C. But the princip is this.
dim angle as float
dim i as integer
main:
for i = 0 to 314 step 1
angel = i div 100
......
next
dim angle as float
dim i as integer
main:
for i = 0 to 314 step 1
angel = i div 100
......
next
Last edited by Seniorlemuren on 08 Jan 2013 11:26, edited 1 time in total.
Regards
Plain common sense is not very common.
Plain common sense is not very common.
-
- Posts: 13
- Joined: 10 Sep 2011 20:37
- Location: FRANCE - Pays de la Loire
Re: for... next loop
OK,
I try this method, it's good, I can make an HEX
Thank for your help
Jean-Paul
I try this method, it's good, I can make an HEX
Thank for your help
Jean-Paul
Re: for... next loop
Hi,
The for loop parameters can be integers only, you cannot use floating point numbers.
Regards,
Filip
The for loop parameters can be integers only, you cannot use floating point numbers.
Regards,
Filip
-
- Posts: 13
- Joined: 10 Sep 2011 20:37
- Location: FRANCE - Pays de la Loire
Re: for... next loop
thank you,
I found an other error in my program :
dim af as float
dim i as integer
for i = 0 to 628
af = i / 100 ' is wrong !
af = i
af = af / 100 ' is correct
next i
Jean-Paul
I found an other error in my program :
dim af as float
dim i as integer
for i = 0 to 628
af = i / 100 ' is wrong !
af = i
af = af / 100 ' is correct
next i
Jean-Paul