Switch y Case
#8

Quote:
Originally Posted by RIDE2DAY
Посмотреть сообщение
Estб resuelto por lo que veo, comento esto por si te interesa aprender algo mбs, podrнas usar operadores ternarios:
PHP код:
Lugar[1] = (Informacion[playerid][Dinero] <= ? ("Lugar vacнo") : ("Dinero"));
/* Es como decir: Informacion[playerid][Dinero] menor o igual a 0 <ENTONCES> ("Lugar vacнo") <DE LO CONTRARIO> ("Dinero") */ 
Tienes mбs informaciуn aquн sobre estos operadores.

Un saludo.
Concuerdo con esto. No me parece un buen uso de sentencias el hecho de usar un switch para sуlo dos casos. Por esto es conveniente usar un operador ternario.

Ademбs acб:

Код:
switch(Informacion[playerid][Dinero])
	{
		case 0:Lugar[1]="Lugar Vacнo";
		default:Lugar[1]="Dinero";
	}
Lugar vacнo deberнa salir tambiйn si se tiene dinero negativo.
Reply


Messages In This Thread
Switch y Case - by Mamoru - 07.08.2016, 13:51
Respuesta: Switch y Case - by Zume - 07.08.2016, 14:31
Respuesta: Switch y Case - by Mamoru - 07.08.2016, 15:00
Re: Switch y Case - by bm0z - 08.08.2016, 11:45
Re: Switch y Case - by RIDE2DAY - 08.08.2016, 14:56
Respuesta: Switch y Case - by Zume - 08.08.2016, 23:37
Respuesta: Switch y Case - by Whyd - 09.08.2016, 09:14
Respuesta: Re: Switch y Case - by Glimma - 09.08.2016, 13:49

Forum Jump:


Users browsing this thread: 3 Guest(s)