title: JavaScript If statement how to use correctly(MVC, Kendo Chart)
body: <p>I have 4 properties and i want to draw a pie chart with them. </p>
  
  <p>My scenerio is like this: When Model.Count equals to 0, i don't want to draw chart. So i added a if statement like this:</p>
  
  <pre><code> &lt;script&gt;
          function createChart() {
  
  
              if (@Model.Count!=0) 
              {
  </code></pre>
  
  <p>But i get an error like(There is no applicable variable or member a):</p>
  
  <pre><code> CS0103: 'a' isn't in the content(i translate this part)
  
   Satır 1150:       
  
           data: [{
  Satır 1151:                    category: "fa",
  Satır 1152:                    value: @a,
  Satır 1153:
  Satır 1154:                }, {
  </code></pre>
  
  <p>So how can i solve this problem? Is there an easy way to solve this problem?</p>
  
  <p>I have model properties like this.</p>
  
  <pre><code>  @{
        if (Model.Count!=0)
           { 
  int a, b, c, d= 0;
  
  a= Convert.ToInt32(Model[0].Prop1);
  b= Convert.ToInt32(Model[0].Prop2);
  c= Convert.ToInt32(Model[0].Prop3);
  d= Convert.ToInt32(Model[0].Prop4);
  
           }
       }
  </code></pre>
  
  <p>Here is my Kendo Chart Script.</p>
  
  <pre><code>&lt;script&gt;
      function createChart() {
  
  
          if (@Model.Count!=0) 
          {
  
          $("#chart55").kendoChart({
              theme: 'metro',
              title: {
                  position: "bottom",
                  text: "Maliyeti"
              },
              legend: {
                  visible: false
              },
              chartArea: {
                  background: ""
              },
              seriesDefaults: {
                  labels: {
                      visible: true,
                      background: "transparent",
                      template: "#= category #: \n #= value#TL"
                  }
              },
              series: [{
                  type: "pie",
                  startAngle: 150,
                  data: [{
                      category: "fa",
                      value: @a,
  
                  }, {
                      category: "za",
                      value: @b,
  
                  }, {
                      category: "ka",
                      value: @c,
  
                  }, {
                      category: "da",
                      value: @d,
  
                  }
  
                  ]
              }],
  
              tooltip: {
                  visible: true,
                  format: "{0}"
              }
          });
          }
      }
  
      $(document).ready(createChart);
      $(document).bind("kendo:skinChange", createChart);
  &lt;/script&gt;
  </code></pre>