For CS50 pset1 Credit I'm using repeated logical-OR operators (||
) to work out the validity and card brand of a credit card number. When I evaluate the style of my code using style50
it says to insert a new line in the longest series of these logical operators. Is there a way of reducing the length of these altogether (other than changing the int
name to something like x
)?
The code currently looks something like this:
else if ((compoundedseriesofwords == yy || compoundedseriesofwords == zz || compoundedseriesofwords == aa || compoundedseriesofwords == bb || compoundedseriesofwords == cc) && compoundedseriesofwords == dd)
Like, can you do something like: compoundedseriesofwords == yy, zz, aa && compoundedseriesofwords == bb
?