Dame
Dame

Reputation: 31

Julia control flow with two or more conditions

I'am new to the Julia language and below is a code that I encode using the Jupyter Notebook, but there is no output but when i tried the same code using the REPL, there is an output. Please help me with this.

NOTE: the value of the variable is set to either 'S' or 's' and the input is a function that i copied from Ismael Venegas Castelló (Julia request user input from script). Thank you by the way Mr. Castelló.

if choose == 'S' || choose == 's'

    str = input("Please input a String.");

    che = input("please input a character to be search");

    search(str, che);

end

Upvotes: 3

Views: 4843

Answers (1)

ramk15
ramk15

Reputation: 21

Worked totally fine for me this way in JuliaPro(0.5.1.1).

julia> choose='s'
's'

julia> function input(prompt::AbstractString="")
              print(prompt)
              return chomp(readline())
          end
input (generic function with 2 methods)

julia> if choose == 'S' || choose == 's'
           str = input("Please input a String.");
           che = input("please input a character to be search");
           search(str, che);
       end
Please input a String.It is working.
please input a character to be searchk
10:10

Upvotes: 2

Related Questions