Hỏi đáp
Chia sẻ kiến thức, cùng nhau phát triển
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("moi ban nhap so : ");
string so = Console.ReadLine();
int so2;
if (int.TryParse(so, out so2) == false) ;
{
Console.WriteLine("du lieu nhap sai");
//return;
}
else
{
Console.WriteLine("du lieu nhap dung");
}
Console.ReadKey();
}
}
}
mình và nó báo lỗi expected
mình nghĩ là do }
nhưng mình đếm thấy đủ { } nhưng nó vẫn báo lỗi
mong các bạn giúp đỡ
Bạn sai cú pháp nha (có thể bạn ghi nhanh quá). Sau if không có ; nha
if (int.TryParse(so, out so2) == false) ; // Bỏ ; đi
bỏ dấu ; ở line 17 nhé bạn :D
Bỏ dấu ; ở cuối if dòng 16 nha bạn !!! :))
Bỏ dấu chấm phẩy cuối if đi bạn