| |

VerySource

 Forgot password?
 Register
Search
Author: hasura

How to apply strings and the "||" operator

[Copy link]

0

Threads

13

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 Singapore

Post time: 2020-6-11 19:45:01
| Show all posts
Only this code does not see what is wrong
Reply

Use magic Report

0

Threads

13

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 Singapore

Post time: 2020-6-11 22:45:02
| Show all posts
It is estimated that ob.scr(sql, "shuju") is wrong, is it returned BOOL, so it is impossible to attach a value to a String
Reply

Use magic Report

0

Threads

20

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 LAN

Post time: 2020-6-11 23:15:01
| Show all posts
topsycholmu
Dude's eyes are really unusual, maybe ob.scr(sql, "shuju") is really it
^^^^^^^^^^^^^^^^^^^
It may also be a compiler problem, maybe original
Reply

Use magic Report

1

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-6-12 07:30:01
| Show all posts
You declare one
bool flag=true
string zxs=ob.scr(sql, "shuju");
        if (zxs=="Beijing" || zxs=="Shanghai" || zxs=="Tianjin City" || zxs=="Chongqing")
        {
            flag=true
        }
        else
        {
            flag=false;
        }
return flag;
Reply

Use magic Report

0

Threads

20

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 LAN

Post time: 2020-6-12 15:30:02
| Show all posts
Maybe
return Kazakhstan, who knows what the director defines as the return
Reply

Use magic Report

0

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 United States

Post time: 2020-6-15 02:00:02
| Show all posts
Step through
Reply

Use magic Report

0

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-6-15 21:00:01
| Show all posts
Well, agree with lsls, see the error message is really string zxs=ob.scr(sql, "shuju"); there is a problem here
The returned estimate is of type bool
Reply

Use magic Report

0

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-6-16 22:30:01
| Show all posts
There are two possibilities:
  
1. Whether the return value of the function of lz is bool type, otherwise, it must be wrong.
2. Whether the return value of ob.scr(sql, "shuju") is of type string, otherwise, an error will occur.

The if(...) conditional expression is no problem, because the priority of relational operators is higher than that of logical operators!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-6-18 12:00:01
| Show all posts
This kind of error is obviously an inadvertent error. Under debugging and tracking, you will know where the problem is!
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-7-1 02:00:01
| Show all posts
There is no problem with the code posted..

The landlord can post the code to see..

Or you can debug it yourself to see where the exception is.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list