How does% in vim compare to strings?

  question, vim

I want to be inifThe conditional statement determines whether the suffix of the current file is equal to a suffix, but%:t:e=="cpp"It seems that it is not the correct grammar. What is the correct grammar?

You need to use expand

if expand('<afile>:t:e') == "cpp"