


{"id":166538,"date":"2022-02-18T13:49:52","date_gmt":"2022-02-18T13:49:52","guid":{"rendered":"\/forum\/forums\/topic\/about-the-selection-of-odd-and-even-numbers-through-if-and-do-loop\/"},"modified":"2022-02-21T21:44:35","modified_gmt":"2022-02-21T21:44:35","slug":"about-the-selection-of-odd-and-even-numbers-through-if-and-do-loop","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/about-the-selection-of-odd-and-even-numbers-through-if-and-do-loop\/","title":{"rendered":"About the selection of odd and even numbers through *IF and *DO loop"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>Dear Community,<\/p>\n<p>I have been practicing a thermal modelling routine in APDL.<\/p>\n<p>The modelling includes a repetition of a certain set of commands and scalar parameters in a cycle. I got it through the *DO and *IF commands. However, the code is getting extremely lengthy and time taking (for compilation) to set *IF command for every *DO parameter value (Like *DO is running from 1 to 100). But, in actuality the scalar parameters on change for the even and odd values of the *DO parameter. <\/p>\n<p>The code I want goes like this (but it is not working)<\/p>\n<p>!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p><strong>*DO,ii,1,100,1<\/strong><\/p>\n<p><strong>*IF,ii,EQ,&#039;EVEN&#039;,THEN<\/strong><\/p>\n<p><strong>X = 1<\/strong><\/p>\n<p><strong>*ELSEIF,ii,EQ,&#039;ODD&#039;,THEN<\/strong><\/p>\n<p><strong>X = 2<\/strong><\/p>\n<p><strong>*ELSE<\/strong><\/p>\n<p><strong>*ENDIF<\/strong><\/p>\n<p>!&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>If anybody knows how to set this working, please help<\/p>\n","protected":false},"template":"","class_list":["post-166538","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_btv_view_count":["753"],"_bbp_likes_count":["0"],"_bbp_subscription":["242957"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["166538"],"_bbp_forum_id":["27790"],"_bbp_engagement":["490","168520"],"_bbp_voice_count":["2"],"_bbp_reply_count":["1"],"_bbp_last_reply_id":["206035"],"_bbp_last_active_id":["206035"],"_bbp_last_active_time":["2022-02-21 21:44:35"]},"test":"shekhars"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/166538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/166538\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=166538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}