Button Pressing

That's what I used

#include <Keyboard.h>
void setup() {
  // make pin 2 an input and turn on the
  // pullup resistor so it goes high unless
  // connected to ground:
  pinMode(2, INPUT_PULLUP);
  pinMode(3, INPUT_PULLUP);
  Keyboard.begin();
}

void loop() {
    //if the button on pin 2 is pressed
  if(digitalRead(2)==LOW){
    //Send the message
    Keyboard.print("Hello!");
    delay(1500);
}
    //if the button on pin 3 is pressed
    if(digitalRead(3)==LOW){
    //Send the message
    Keyboard.print("World!");
    delay(1500); }
}