AdeptLanguage / Adept

The Adept Programming Language
GNU General Public License v3.0
119 stars 9 forks source link

What's wrong with the code? #61

Closed Spoiledpay closed 2 years ago

Spoiledpay commented 2 years ago

I noticed that when using the for function, with more than one parameter inside it gets lost. Can you check what happens in the codes below?

= no Work. import basics //pragma ignore_unused

func main {

// More traditional version
for(i int = 0; i < 20; i++){
    printf("%d ", i);
printf("%d ", i);

}

}

output:

C:\Adept\Example\for>for1.exe 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

= Works"

import basics //pragma ignore_unused

func main {

// More traditional version
  for(i int = 0; i < 10; i++){
    printf("%d ", i)
printf("%d ", i)
}

}

output: C:\Adept\Example\for>for1.exe 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9

IsaacShelton commented 2 years ago

This is a bug in Adept 2.4. Version 2.5 solves this issue

import basics

func main {
    // More traditional version
    for(i int = 0; i < 20; i++){
        printf("%d ", i);
        printf("%d ", i);
    }
}
0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19

If you don't want to update to 2.5 yet, you can acheive the same effect by using a repeat loop:

import basics

func main {
    repeat 20 {
        printf("%d ", idx)
        printf("%d ", idx)
    }
}
IsaacShelton commented 2 years ago

If you have both Adept 2.4 and Adept 2.5 preview installed, you can specify to use adept2-5 instead of adept when compiling your project:

adept2-5 my_file.adept

Or another option is if you want to uninstall Adept 2.4 so that Adept 2.5 is the default, you can run C:\Adept\2.4\uni000.exe

Spoiledpay commented 2 years ago

If you have both Adept 2.4 and Adept 2.5 preview installed, you can specify to use adept2-5 instead of adept when compiling your project:

adept2-5 my_file.adept

Or another option is if you want to uninstall Adept 2.4 so that Adept 2.5 is the default, you can run C:\Adept\2.4\uni000.exe

Thanks for the answer. I will use the new version 2.5 Preview.