{"id":77774,"date":"2020-01-22T16:44:32","date_gmt":"2020-01-22T11:14:32","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/tutorial\/?p=77774"},"modified":"2024-04-12T14:29:55","modified_gmt":"2024-04-12T08:59:55","slug":"operators-2","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/","title":{"rendered":"Operators"},"content":{"rendered":"<h4 class=\"w-post-elm post_title us_custom_49f317a8 align_center entry-title color_link_inherit\" style=\"text-align: left;\"><strong>Operators<\/strong><\/h4>\n<p>NASL provides arithmetic, comparison, and assignment operators. These operators are explained in the following sections.<\/p>\n<p><strong>Arithmetic Operators<\/strong><\/p>\n<p>Here are the common arithmetic operators:<\/p>\n<p>+Used to add numbers. It can also be used to perform string concatenation.<\/p>\n<p>-Used to perform subtraction. It can also be used to perform string subtraction. For example, &#8216;cat, dog, mouse&#8217; &#8211; &#8216;, dog&#8217; results in the string &#8216;cat, mouse&#8217;.<\/p>\n<p>*Used to multiply numbers.<\/p>\n<p>\/Used to divide numbers. Note that NASL will return a 0 if you try to divide by zero.<\/p>\n<p>%Used to perform a modulo operation. For example, 10%3 computes to 1.<\/p>\n<p>**Used to perform exponentiation. For example, 2**3 computes to 8.<\/p>\n<p>++Used to increment a variable&#8217;s value by 1. When a variable is prefixed by this operator (example: ++c), its value is incremented before it is evaluated. When a variable is post-fixed by this operator (example: c++), its value is incremented after it is evaluated.<\/p>\n<p>\u2014Used to decrement a variable&#8217;s value by 1. When a variable is prefixed by this operator (example: &#8211;c), its value is decremented before it is evaluated. When a variable is post-fixed by this operator (example: c&#8211;), its value is decremented after it is evaluated.<\/p>\n<p><strong>Comparison Operators<\/strong><\/p>\n<p>Here are the common comparison operators:<\/p>\n<p>&gt;Used to test whether a given value is greater than the other.<\/p>\n<p>&gt;=Used to test whether a given value is greater than or equal to the other.<\/p>\n<p>&lt;Used to test whether a given value is less than the other.<\/p>\n<p>&lt;=Used to test whether a given value is less than or equal to the other.<\/p>\n<p>==Used to test whether a given value is equal to the other.<\/p>\n<p>!=Used to test whether a given value is not equal to the other.<\/p>\n<p>&gt;&lt;Used to test whether a given substring exists within a string. For example, &#8216;123&#8217;&gt;&lt;&#8216;abcd123def&#8217; evaluates to TRUE.<\/p>\n<p>&gt;!&lt;Used to test whether a given substring does not exist within a string. In this case, &#8216;123&#8217;&gt;!&lt;&#8216;abcd123def&#8217; evaluates to FALSE.<\/p>\n<p>=~Used to match a regular expression. Using this operator is similar to calling the ereg( ) function call, which performs a similar operation. For example, the statement str =~ &#8216;^[GET \/ HTTP\/1.0\\r\\n\\r\\n][.]*&#8217;) evaluates to TRUE only if str begins with the string GET \/ HTTP\/1.0\\r\\n\\r\\n.<\/p>\n<p>!~Used to test whether a regular expression does not match. It is the opposite of the =~ operator.<\/p>\n[]Used to select a character from a string by index. For example, if mystring is a1b2c3, mystring[3] evaluates to 2.<\/p>\n<p><strong>Assignment Operators<\/strong><\/p>\n<p>Here are the common assignment operators:<\/p>\n<p>=Used to assign a value to a variable.<\/p>\n<p>+=Used to increment a variable&#8217;s value. For example, a += 3 increments the value of a by 3, and is equivalent to the statement a = a + 3.<\/p>\n<p>-=Used to decrement a variable&#8217;s value. For example, a -=3 decrements the value of a by 3, and is equivalent to the statement a = a &#8211; 3.<\/p>\n<p>*=Used to multiply a variable&#8217;s value by a specified value. For example, a *= 3 causes the variable a to be assigned a value equal to itself multiplied by 3, and is equivalent to the statement a = a * 3.<\/p>\n<p>\/=Used to divide a variable&#8217;s value by a specified value. For example, a \/=3 causes the variable a to be assigned a value equal to itself divided by 3, and is equivalent to the statement a = a \/ 3.<\/p>\n<p>%=Used to assign a variable a value equal to the remainder of a division operation between itself and a specified value. For example, a %=3 causes the variable a to be assigned a value that is equal to the remainder of the operation a\/3, and is equivalent to the statement a = a % 3.<\/p>\n<h3>Apply for Network Security Open Source Software Developer Certification Now!!<\/h3>\n<p><a href=\"https:\/\/www.vskills.in\/certification\/network-security-open-source-software-developer-certification\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.vskills.in\/certification\/network-security-open-source-software-developer-certification<\/a><\/p>\n<h4><strong><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/network-security-open-source-software-certification\/\" target=\"_blank\" rel=\"noreferrer noopener\">Back to Tutorial<\/a><\/strong><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>Operators NASL provides arithmetic, comparison, and assignment operators. These operators are explained in the following sections. Arithmetic Operators Here are the common arithmetic operators: +Used to add numbers. It can also be used to perform string concatenation. -Used to perform subtraction. It can also be used to perform string subtraction. For example, &#8216;cat, dog, mouse&#8217;&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[9066],"tags":[1433],"class_list":["post-77774","page","type-page","status-publish","hentry","category-network-security-open-source","tag-operators"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Operators - Tutorial<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Operators - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Operators NASL provides arithmetic, comparison, and assignment operators. These operators are explained in the following sections. Arithmetic Operators Here are the common arithmetic operators: +Used to add numbers. It can also be used to perform string concatenation. -Used to perform subtraction. It can also be used to perform string subtraction. For example, &#8216;cat, dog, mouse&#8217;...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:59:55+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/\",\"name\":\"Operators - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2020-01-22T11:14:32+00:00\",\"dateModified\":\"2024-04-12T08:59:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Operators\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Operators - Tutorial","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/","og_locale":"en_US","og_type":"article","og_title":"Operators - Tutorial","og_description":"Operators NASL provides arithmetic, comparison, and assignment operators. These operators are explained in the following sections. Arithmetic Operators Here are the common arithmetic operators: +Used to add numbers. It can also be used to perform string concatenation. -Used to perform subtraction. It can also be used to perform string subtraction. For example, &#8216;cat, dog, mouse&#8217;...","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:59:55+00:00","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/","name":"Operators - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2020-01-22T11:14:32+00:00","dateModified":"2024-04-12T08:59:55+00:00","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/operators-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Operators"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/77774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=77774"}],"version-history":[{"count":5,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/77774\/revisions"}],"predecessor-version":[{"id":134455,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/77774\/revisions\/134455"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=77774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=77774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=77774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}