Computer Science Canada

I cant get my program to work properly

Author:  slider203 [ Sun May 24, 2009 3:45 pm ]
Post subject:  I cant get my program to work properly

Hello could anyone please help me to figure out what is wrong with my code anyhelp woild be greatly appreciated.

const start:= "10"
const finish:= "1"
for decreasing count: start .. finish
put 12 div count
end for

I cant make it run and im not sure why

Thanks very much

Author:  Dusk Eagle [ Sun May 24, 2009 3:57 pm ]
Post subject:  Re: I cant get my program to work properly

First, please use syntax tags, like this:
code:
[syntax="turing"]
%%code here
[/syntax]


As for your problem, do you know what type of value your constants are (i.e. are they strings? or integers?). By declaring their type, you can be sure what type they are. Like this:
Turing:

const x : int := 10

By putting quotation marks around the value of your variables, you have inadvertently made them strings, which is why your program will not run.

Author:  zero-impact [ Sun May 24, 2009 4:37 pm ]
Post subject:  RE:I cant get my program to work properly

This is because for loops only work when you give them integers.

Author:  Kharybdis [ Sun May 24, 2009 5:36 pm ]
Post subject:  Re: I cant get my program to work properly

Turing:
const start:= "10"
const finish:= "1"
for decreasing count: start .. finish
put 12 div count
end for


Should be ...


Turing:
const start := "10"
const finish := "1"
for decreasing count : strint (start) .. strint (finish)
    put 12 div count
end for


: