answersLogoWhite

0

Why we can't use semicolon at the end of if ststement?

Updated: 8/20/2019
User Avatar

Wiki User

12y ago

Best Answer

The computer language has a grammar for the syntax. Not all computer languages using ; to end a statement.

The if-statements DO end with an ; (except when a <compound statement>) in C#, C, PHP, and Java (and many others). In fact, most of <statement> end with ; in those languages, and <if-statement> is just one of the derived <statement>.

However, for statements like: if (1 == 2) {} else {}, the {} is a <compound statement> which does not end with a ; syntactically.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why we can't use semicolon at the end of if ststement?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you use a semicolon at the end of a sentence?

No, a semicolon is not used at the end of a sentence; it is typically used to connect two independent clauses that are closely related.


When do you use a semicolon in algebra?

Well, according to what I learned when I was in Algebra I, you should never have to use a semicolon.


When to use simicolon?

Semicolon is a part of punctuation used mostly in coding. It denotes the end of line in many programming languages.


A sentence with the word semicolon?

I can give you several sentences.You use a semicolon to separate two clauses.A semicolon is like a comma with a period on top of it.You need to learn how to use the semicolon properly.


Can you use two semicolon in one sentennce?

NO


Can you use a gerund after a semicolon?

Yes, you can use a gerund after a semicolon in a sentence. The semicolon is used to join two closely related independent clauses, and a gerund can function as a noun in a sentence. Make sure the gerund phrase after the semicolon complements or expands upon the information in the first clause.


How do you use semicolon in if sentence?

I wouldn't use a semicolon in a conditional (if) sentence. Semicolons can join two independent clauses without a conjunction. The "if" clause in a conditional sentence is dependent, not independent.


How do you use a semicolon in a series?

Example-They use they following things:pens, pencils, and markers


In which of the-following situations would it be appropriate to use a semicolon?

To replace conjunctions and, or, but and to connect the main clauses in a compound sentence


Do you use and after a semicolon?

No, the word &quot;and&quot; should not follow a semicolon. Semicolons are used to separate independent clauses; if you want to include &quot;and,&quot; it would typically be used within one of the independent clauses separated by the semicolon.


Can two independent clauses be joined by using a semicolon between the clauses without a conjunction?

Yes, that is one of the most common uses of a semicolon. If there is a conjunction joining the clauses, however, you should use a comma instead of a semicolon.


Do you use a semicolon before except?

No, a semicolon is not typically used before &quot;except&quot; in a sentence. Instead, a comma may be used to separate clauses or phrases when necessary.