How do I do nothing for the last else statement, and move on to the next part of the array?
12,803
Solution 1
You can just not use an else. Or use a continue
statement, if you want the else to be there.
Solution 2
If you wish your program to just fall through to the next statement, just don't include another else
part of have an empty
body as shown by you.
Author by
Admin
Updated on June 04, 2022Comments
-
Admin almost 2 years
What should I do
If I input "a a" and shift it once I expect it to return "b b" however I get an error I want to the for loop to skip over anything that isn't A-Z, a-z, or 0-9
for ( ; i <= w; i++) if ((word[i] + rotx) >= 65 && (word[i] + rotx) <=90) { word[i] += (rotx); } else if ((word[i] + rotx) >= 97 && (word[i] + rotx) <=122) { word[i] += (rotx); } else if ((word[i] + rotx) >= 48 && (word[i] +rotx) <= 57) { word[i] += (rotx); } else if ((word[i] + rotx) > 90 && (word[i]+rotx) <97) { word[i] = 64 + (rotx - (90-word[i])); } else if ((word[i] + rotx) > 122) { word[i] = 96 + (rotx - (122-word[i])); } else if ((word[i] + rotx) > 57) { word[i] = 47 + (rotx - (57-word[i])); }
OUTPUT enter string "a a" enter rotations 1
-bash: 1: command not found