jeudi 16 mai 2019

And then in the C++ conditional

Ada has nice feature of and then statement used in the if condition. This allows for checking if, e.g., the object is not null before accessing it like so:

if Object /= null and then Object.Value > 5 then
   -- do something with the value
end if;

Is there a way to express a similar behaviour in C++ w/o using a nested if?

Aucun commentaire:

Enregistrer un commentaire