We don't have any direct equivalent for this in COBOL syntax. Of course, it's possible to do this in two lines in COBOL: declare ReturnValue as string if Expression set ReturnValue to TruePart else set ReturnValue to FalsePart end-if ...but probably most people would split this and use normal indentation for the sake of readability. I think the C# (and C) '?' syntax is probably most useful in contexts like parameter passing, and it's certainly possible we might want to add a construct like this to the language at some point.
↧