cc65 : i want to leave this if if it is true.

You need an actual VIC.

Moderator: Moderators

Post Reply
funkheld
Vic 20 Devotee
Posts: 241
Joined: Tue Sep 10, 2019 4:23 am

cc65 : i want to leave this if if it is true.

Post by funkheld »

Hi good afternoon.

i want to leave this if if it is true.
how does that work please

with break I also leave the main loop and I don't want that.

Thank you.
greeting

Code: Select all

ip=y*22+x+scradr;
if (PEEK(p)==1)
{
.......
}	
POKE(p,0);
x=x+1;
p=y*22+x+scradr;
POKE(p,32);
x=x-1;
.........
}
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: cc65 : i want to leave this if if it is true.

Post by beamrider »

can you post the whole program, that extract doesn't make much sense

what do you mean by "leave this if"?
funkheld
Vic 20 Devotee
Posts: 241
Joined: Tue Sep 10, 2019 4:23 am

Re: cc65 : i want to leave this if if it is true.

Post by funkheld »

Hi good afternoon.

I didn't want to take "break".

is there anything else for this?

Thank you.
greeting
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: cc65 : i want to leave this if if it is true.

Post by Mike »

As beamrider already wrote, it is not possible to infer - from your question and the source fragment you give - what the actual problem *is*!

We're talking about *basics* of structured programming here: if you have a code sequence S1, which shall be executed upon a predicate P being true, another code sequence S2, which shall be executed upon same predicate P being false (i.e. not true), have some code sequence S3 which doesn't depend upon P but is supposed to be executed before either S1 or S2, and finally have some code sequence S4 which also doesn't depend upon P but is supposed to be executed after either S1 or S2, you write this as follows:

Code: Select all

S3
if(P)
  S1
else
  S2
S4
... with S1 and S2 each either a single statement ended by a semicolon, or a compound statement enclosed in curly braces {...}, where the closing brace is *not* followed by a semicolon.

In C, the break statement does not operate upon the "if(<condition>) <statement> else <statement>" structure as given above, but it terminates the innermost surrounding loop (for, do, while) or switch statement.
funkheld
Vic 20 Devotee
Posts: 241
Joined: Tue Sep 10, 2019 4:23 am

Re: cc65 : i want to leave this if if it is true.

Post by funkheld »

he thanks for hlep.

greeting
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: cc65 : i want to leave this if if it is true.

Post by Mike »

This post here also in response to many other similar inquiries you're doing here in Denial:
funkheld wrote:he thanks for hlep.
Please follow up with a post how it helped you in that particular case.

Just getting a meagre "thanks" is not sufficient at all, if no one else but you gets some information from it!

This is a public forum, sharing of knowledge is a very important aspect of it, but at the moment you're asking for far more than what you're giving back.

'nuf said.
Post Reply