Comments
 
Comments are regions of text that the compiler will ignore but may contain information that is useful to the programmer. One exception are metacommands which may appear in certain types of comments.

Single Line comments

The single quote character (') may be used to indicate a comment and may appear after other keywords on a source line. The rest of the statement will be treated as a comment.
' comment text


The comment statement: Rem

A source code statement beginning with Rem indicates that the rest of the line is comment and will not be compiled. Rem behavior is the same as above, except it must be the first keyword in the statement.
Rem comment


Multi-line comments

Multi-line comments are marked with the tokens /' and '/. All text between the two markers is considered comment text and is not compiled.

Multi-line comments can span several lines, and can also be used in the middle of statements. After the end of the comment, the statement will continue to be parsed as normal (even if the comment crosses line breaks).
/' Multi-line
   comment '/

Print "Hello" /' embedded comment'/ " world"

Note: If FreeBASIC encounters a close-comment marker while it's not in a multi-line comment, it will treat it as a normal single-line comment due to the single quote.

Nested Comments

A multi-line comment can contain other multi-line comments inside it. Each inner comment has its own open- and close-comment markers.

/'
 This is a comment.
 /'
  This is a comment inside a comment
 '/
    This Is a comment.
'/

A multi-line comment can contain unlimited levels of nested comments. FreeBASIC will continue to parse the multi-line comment for more markers until the number of close-comment markers reaches the number of open-comment markers, i.e. when it has closed all the comments it has opened.

Comments after line continuation

A single-line comment may appear after the line continuation character ( _ ) in a multi-line statement. FreeBASIC does not parse the text after the line continuation character, though, so you can't open multi-line comments after them.

Print _ ' line
    "This is part of the previous line's statement"


Metacommands

Metacommands, such as $Static and $Include, can be placed in single-line comments. The $ sign and the keyword must be the first two things in the statement, not including white space.

Rem compile With -lang fblite Or qb

#lang "fblite"

Rem $Static
' $include: 'vbcompat.bi'


Single-line comment parsing

When you make a single-line comment, FreeBASIC will parse the comment, to check for a metacommand. If it finds a multi-line comment, it will treat it as usual, and continue parsing the single-line comment after the close-comment marker.

If you want to prevent FreeBASIC parsing the single-line comment, put another single quote ('), at the start of the comment. FreeBASIC will treat the rest of the line, including multi-line comment markers and metacommands, as ordinary text, and will ignore it. Other words encountered in a comment will also stop the parsing.
    • Note: As of version 0.21.0, this will not longer apply in the -lang fb dialect, and multi-line comment markers will be completely ignored inside single-line comments

'' $static <-- will not get parsed
'' this multiline comment marker ("/'") will be ignored
Print "This line is not a comment."


Example

/' this is a multi line 
comment as a header of
this example '/

Rem This Is a Single Line comment

'this is a single line comment

Dim a As Integer   'comment following a statement

Dim b As /' can comment in here also '/    Integer


#if 0
    before version 0.16, This was the
    only way of commenting Out sections
    With multiple lines of code.
#endif



See also



Сайт ПДСНПСР. Если ты патриот России - жми сюда!


Знаете ли Вы, что, как не тужатся релятивисты, CMB (космическое микроволновое излучение) - прямое доказательство существования эфира, системы абсолютного отсчета в космосе, и, следовательно, опровержение Пуанкаре-эйнштейновского релятивизма, утверждающего, что все ИСО равноправны, а эфира нет. Это фоновое излучение пространства имеет свою абсолютную систему отсчета, а значит никакого релятивизма быть не может. Подробнее читайте в FAQ по эфирной физике.

НОВОСТИ ФОРУМАФорум Рыцари теории эфира
Рыцари теории эфира
 10.11.2021 - 12:37: ПЕРСОНАЛИИ - Personalias -> WHO IS WHO - КТО ЕСТЬ КТО - Карим_Хайдаров.
10.11.2021 - 12:36: СОВЕСТЬ - Conscience -> РАСЧЕЛОВЕЧИВАНИЕ ЧЕЛОВЕКА. КОМУ ЭТО НАДО? - Карим_Хайдаров.
10.11.2021 - 12:36: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от д.м.н. Александра Алексеевича Редько - Карим_Хайдаров.
10.11.2021 - 12:35: ЭКОЛОГИЯ - Ecology -> Биологическая безопасность населения - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> Проблема государственного терроризма - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> ПРАВОСУДИЯ.НЕТ - Карим_Хайдаров.
10.11.2021 - 12:34: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вадима Глогера, США - Карим_Хайдаров.
10.11.2021 - 09:18: НОВЫЕ ТЕХНОЛОГИИ - New Technologies -> Волновая генетика Петра Гаряева, 5G-контроль и управление - Карим_Хайдаров.
10.11.2021 - 09:18: ЭКОЛОГИЯ - Ecology -> ЭКОЛОГИЯ ДЛЯ ВСЕХ - Карим_Хайдаров.
10.11.2021 - 09:16: ЭКОЛОГИЯ - Ecology -> ПРОБЛЕМЫ МЕДИЦИНЫ - Карим_Хайдаров.
10.11.2021 - 09:15: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Екатерины Коваленко - Карим_Хайдаров.
10.11.2021 - 09:13: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вильгельма Варкентина - Карим_Хайдаров.
Bourabai Research Institution home page

Боровское исследовательское учреждение - Bourabai Research Bourabai Research Institution