C knowers: Why can't I do this in C?!

char *s = "><+-.,[]";
char test(char c) {
for (int i = 0; i < strlen(s); i++) {
c == s[i] && return i;
}
}

@vaporeon_ this should be allowed, who knew that c was bad actually

@wallhackio Reported for slandering the best programming language ever invented

Follow

mean 

@wallhackio @amy @vaporeon_ honestly, not intuiting a distinction would have been made between expressions and statements was an L in the furst place

re: mean 

@aescling @wallhackio @amy Yes, big L for me :(

My thought was "use the short-circuiting of &&, like in Bash or Perl", but that won't work because the second half also needs to be an expression, something that can be evaluated to a number, and return or if or goto can't be evaluated to a number!

Pretty sure (but too lazy to test) that this won't work in Bash and in Perl, either.

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.