479
submitted 11 months ago* (last edited 11 months ago) by KingThrillgore@lemmy.ml to c/196@lemmy.blahaj.zone
you are viewing a single comment's thread
view the rest of the comments
[-] Frozzie@lemmy.world 76 points 11 months ago

So you're saying I can use the semicolon in a different context other than ending an instruction in my Java code ?

[-] SpaceNoodle@lemmy.world 52 points 11 months ago* (last edited 11 months ago)

Yes, you can end a statement in C or C++ as well.

[-] Perfide@reddthat.com 16 points 11 months ago

And, dare I say it, Javascript.

[-] SpaceNoodle@lemmy.world 28 points 11 months ago* (last edited 11 months ago)

What the fuck? There are children here. Don't say shit like that.

[-] perviouslyiner@lemm.ee 5 points 11 months ago

or begin a comment in Inno

[-] FlyingSquid@lemmy.world 2 points 11 months ago

What about Applesoft BASIC? Because I was pretty good at that on my Apple II, but I don't think there were semicolons.

Also, I don't know how to code, so I don't know what semicolons are for in code.

[-] SpaceNoodle@lemmy.world 3 points 11 months ago

BASIC statements end on new lines. The language does use a semicolon at the end of PRINT statements in order to omit printing a newline character at the end, but I believe that's the only use. (It's been about 20 years since I've done anything in BASIC.)

The meaning of a semicolon depends completely on the language. C and C-like languages (like Java and Rust) tend to use them to delimit the end of a statement.

[-] n0clue@lemmy.world 20 points 11 months ago
[-] Heavybell@lemmy.world 5 points 11 months ago

You can also use them to split lists where the items have commas in them. Like if you're saying you're holding a party and you invited A, whom you dislike but would feel bad to exclude; B, who you've not seen in years and really want to catch up with; and C, who is also going to be there.

this post was submitted on 20 Dec 2023
479 points (100.0% liked)

196

16494 readers
2887 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS