This may sound crazy.... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

This may sound crazy....

But is it possible to have the console say different things every time you run it?

17th Aug 2016, 1:23 AM
Aquarius
Aquarius - avatar
5 Answers
+ 1
Yes, just randomize the outputs. Put your strings in an array or list, then just put a random in the index during output.
17th Aug 2016, 2:24 AM
James
James - avatar
+ 1
you can create an array and call api random to make this or an arraylist and call shuffle method.
17th Aug 2016, 2:44 AM
Gorick X
Gorick X - avatar
+ 1
Yes, create a scanner input variable, then if statements or switch. Put storylines in each case or if, then run the appropriate story based on user input. If I may also make a suggestion, might be beneficial for you to learn XML if you plan on doing storylines. Markup/Scripting languages are excellent at setting up String flows.
17th Aug 2016, 4:16 AM
James
James - avatar
0
thanks, but is there in anyway possible to have it run different things in a order that i choose ot to be. like for example: 1.StoryLine --user input 2. StoryLine --user input etc....
17th Aug 2016, 3:35 AM
Aquarius
Aquarius - avatar
0
ok thanks james
17th Aug 2016, 11:03 AM
Aquarius
Aquarius - avatar