Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

modolo operator on RR3

 
Jimmy Bonds
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class LeapYear
{
int year;

int getY(int i)
{
year=i;
return year;
}

void leepY()
{
if((year%100=0)|(year%400=0))
{
System.out.println("Not a Leap Year!");
}
else if(year%4=0)
{
System.out.println("Leap Year!!");
}
else
{
System.out.println("not a Leap Year!");
}
}
}
Hi all,
When I run the preceeding code I get a compile error saying-
"invalid left hand side of assignment:
if((year%100=0)|(year%400=0))"
^
It's my understanding that the expression to be evaluated should be on the left, such as: 10%3=1.
Where 10 is the expression.
Please set me straight!

 
Junilu Lacar
Bartender
Pie
Posts: 7761
62
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use "==" for comparing two things for equality. "=" assigns the value on the right side to whatever is on the left side.
Junilu
 
Jimmy Bonds
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DOH!!!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic