A bug in my project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A bug in my project

public class Program { public static void main(String[] args) { int x = 12; while (x < 100) { System.out.println(x); x * 2; } } }

1st Jun 2019, 1:44 PM
Moein
1 Answer
+ 3
It should be x = x*2 or shortly x *= 2. When you just write x*2 it's not clear for the program where do you store the result of that operation.
1st Jun 2019, 1:50 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar