Ask coding questions

← Back to all posts
if and else statements in c++

so i have been learning c++ and im trying to recreate the first program i made in python but im confused on how if, elif(if it exists in c++), and else but no operators are working like = or ==


if and else statements in c++ are what they seem like, in your repl it looks like you are using them correctly.

if (a) {code} else if (b) {code} else {code}

elif does not exist in c++ its only a python thing, use else if instead

one thing to note is that c++ does not care about whitespace so format your code however you like