How to print variable and text?

Hi, I’m very new to Arduino and I have been trying to code something where every time I press a button, the number next to P: on an lcd will go up by 1. To do that I need to have P: (variable), but I can’t figure out how to. This is my code attempts so far.

#include <LiquidCrystal_I2C.h>

int ButtonPin = 2;

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {

pinMode(ButtonPin, INPUT);
lcd.begin();
}

void loop() {

int buttonInfo = digitalRead(ButtonPin);
int Period = Period + buttonInfo;
lcd.setCursor(12, 1);
lcd.print("P: ",Period);

}

What happends when You run this code?

The hello world example in whatever library you are using should have all you need. You should put lcd.print("P: "); in Setup, and lcd.print(Period); in the loop

https://www.youtube.com/watch?v=1cg9mXA2XRE

Nick_Pyner: The hello world example in whatever library you are using should have all you need. You should put lcd.print("P: "); in Setup, and lcd.print(Period); in the loop

Thanks!