Posted: Fri Mar 04, 2011 4:19 pm Post subject: RE:help - calender
maybe its because i used a string. i think i need to change it to an integer, and associate each day with a number.
DemonWasp
Posted: Fri Mar 04, 2011 4:21 pm Post subject: RE:help - calender
What Tony is hinting at is that that condition isn't doing what you think it is. The error message is actually pretty direct here. It's telling you that the operator "or" only works on booleans. That means that the value to the left and the value to the right must BOTH be booleans.
When Turing looks at your code file, it sees it like this:
if - starting an if-statement, good
day not= "Monday" - conditional, returns boolean, good
or "Tuesday" - what's that supposed to mean?!
What you really mean is this:
if not ( day = "Monday" or day = "Tuesday" or ... ) then
This gives you the logic you are after. First, you compare the value in day against each of "Monday"..."Friday"; if it matches any of those values, then the contents of the parenthesis returns true. You then negate that result with "not" and end up with true if and only if the value in day is NOT one of "Monday"..."Tuesday".
whoareyou
Posted: Fri Mar 04, 2011 5:26 pm Post subject: Re: RE:help - calender
DemonWasp @ Fri Mar 04, 2011 4:21 pm wrote:
What Tony is hinting at is that that condition isn't doing what you think it is. The error message is actually pretty direct here. It's telling you that the operator "or" only works on booleans. That means that the value to the left and the value to the right must BOTH be booleans.
When Turing looks at your code file, it sees it like this:
if - starting an if-statement, good
day not= "Monday" - conditional, returns boolean, good
or "Tuesday" - what's that supposed to mean?!
What you really mean is this:
if not ( day = "Monday" or day = "Tuesday" or ... ) then
This gives you the logic you are after. First, you compare the value in day against each of "Monday"..."Friday"; if it matches any of those values, then the contents of the parenthesis returns true. You then negate that result with "not" and end up with true if and only if the value in day is NOT one of "Monday"..."Tuesday".
THAT WAS CORRECT! :O
Thank you!
So by using your technique, my code now works and looks like this. However, it is not finished. If i run into more problems, i'll be sure to post back here!
loop put"What day does the month start on?" get day
if day ="Monday"or day ="Tuesday"or day ="Wednesday"or day ="Thursday"or day ="Friday" or day ="monday"or day ="tuesday"or day ="wednesday"or day ="thursday"or day ="friday" then else put"That is not a valid day!"
endif exitwhen day ="Monday"or day ="Tuesday"or day ="Wednesday"or day ="Thursday"or day ="Friday" or day ="monday"or day ="tuesday"or day ="wednesday"or day ="thursday"or day ="friday" endloop
if day ="Monday"or day ="monday"then for i: 1.. nodays
put" ", i:10..
daycount +=1
if(daycount mod7=0)then put""
daycount :=0 endif
endfor endif
I have it set up so that it will run when i enter 30 days and the start date is on monday.
however, the numbers won't allign under the right date properly.
i dont underestand how i can use spaces, because then each number will get spaces and it will go off the calender.
also, it won't go onto the next line once it reaches saturday.