Why does this code line not work?

So this code I wrote with some help of other sections of forums, why is it not working? The light on pin 10 stays lit even with any press of the button. Here is the lines:

const int LEDPin = 10;
const int button = 9;

void setup() {
pinMode(9, INPUT);
pinMode(10, OUTPUT);

// put your setup code here, to run once:


void loop() {
if(digitalRead(9 <= 900)){
digitalWrite(10, HIGH); }

else{(digitalWrite(10, LOW)); }

Misplaced )

Always true, guaranteed.

Maybe you meant analogRead, but unless you're on a Mega, you probably don't have an analogue pin 9.

Please remember to use code tags when posting code

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Perhaps a quick read of the Arduino documentation for digitalRead would help.

The function digitalRead() returns either HIGH or LOW to indicate the state of the input pin.

Thanks. I am on an UNO, and I just started posting and using Arduino, what are code tags?

A Uno doesn't have analogue pin 9.
Digital pin 9 will return LOW (aka zero) or HIGH (aka one) both of which are less than 900.

What were you trying to do?

I'll leave to figure out code tags.

That code will evaluate the condition (9 <= 900), which will always be true. True has a value of 1 (false has a value of 0), so the code is equivalent to

if (digitalRead(1)){

It also depends on how you have wired up your push switch.
See http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination