What is the syntax for testing if a value is greater than or equal to sthg?


#1

Hello!
First time posting here :slight_smile: I’m currently trying to solve the Gridmancer and I think I’m pretty close to the solution. But I can’t find a wat to test if a value is “greater than or equal to” another. I could work my way around it with ifs and ors, but it would be pretty ugly.

Could someone indicate me the correct syntax please ? I’ve tried >==, it doesn’t return any error but it doesn’t seem to work either.

Thanks a lot!

And by the way, CodeCombat is awesome! :slight_smile:

Mat


#2

The correct value to test in JavaScript to test for equality is not >== and in fact, that operator doesn’t even exists I think. Let me list you the comparison operators:

  • Value Equal to: ==
  • Value and Type equal to: ===
  • Value not equal to: !=
  • Value and Type not equal to: !==
  • greater than: >
  • less than: <
  • greater than or equal to: >=
  • less than or equal to: <=

So you can check if x is greater than or equal to y as follows:

  • x >= y
  • this will return true if x is greater than or equal to y!

Good luck with the Gridmancer level and your adventure on CodeCombat!


#3

Thanks a lot! So it appears my code is wrong. I’m ont it!
Have a nice day :slight_smile: